21 #include "itkImageFileReader.h"
22 #include "itkImageRegionIterator.h"
23 #include "itkMetaDataObject.h"
24 #include "itkNrrdImageIO.h"
48 std::vector<itk::SmartPointer<mitk::BaseData> > result;
53 throw itk::ImageFileReaderException(__FILE__, __LINE__,
"Sorry, the filename of the vessel tree to be read is empty!");
61 typedef itk::VectorImage<float,3>
ImageType;
63 typedef itk::ImageFileReader<ImageType> FileReaderType;
65 reader->SetImageIO(io);
66 reader->SetFileName(location);
70 typedef itk::Image<itk::Vector<float,QBALL_ODFSIZE>,3> VecImgType;
72 vecImg->SetSpacing( img->GetSpacing() );
73 vecImg->SetOrigin( img->GetOrigin() );
74 vecImg->SetDirection( img->GetDirection() );
75 vecImg->SetLargestPossibleRegion( img->GetLargestPossibleRegion());
76 vecImg->SetBufferedRegion( img->GetLargestPossibleRegion() );
79 itk::ImageRegionIterator<VecImgType> ot (vecImg, vecImg->GetLargestPossibleRegion() );
82 itk::ImageRegionIterator<ImageType> it (img, img->GetLargestPossibleRegion() );
87 for (it.GoToBegin(); !it.IsAtEnd(); ++it)
89 VarPixType vec = it.Get();
90 FixPixType fixVec(vec.GetDataPointer());
96 resultImage->InitializeByItk( vecImg.GetPointer() );
97 resultImage->SetVolume( vecImg->GetBufferPointer() );
98 result.push_back( resultImage.GetPointer() );
101 catch(std::exception& e)
103 throw itk::ImageFileReaderException(__FILE__, __LINE__, e.what());
107 throw itk::ImageFileReaderException(__FILE__, __LINE__,
"Sorry, an error occurred while reading the requested vessel tree file!");
virtual ~NrrdQBallImageReader()
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
map::core::discrete::Elements< 3 >::InternalImageType ImageType
us::ServiceRegistration< IFileReader > RegisterService(us::ModuleContext *context=us::GetModuleContext())
Convenience class to temporarily change the current locale.
virtual std::vector< itk::SmartPointer< BaseData > > Read() override
Reads a path or stream and creates a list of BaseData objects.
Base class for creating mitk::BaseData objects from files or streams.
virtual std::string GetInputLocation() const override
Get the current input location.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.