18 #include "itkMetaDataDictionary.h"
19 #include "itkMetaDataObject.h"
20 #include "itkNrrdImageIO.h"
21 #include "itkImageFileWriter.h"
48 MITK_ERROR <<
"Sorry, input to NrrdQBallImageWriter is NULL!";
51 if ( this->GetOutputLocation().empty() )
53 MITK_ERROR <<
"Sorry, filename has not been set!";
60 io->SetFileType( itk::ImageIOBase::Binary );
61 io->UseCompressionOn();
63 typedef itk::VectorImage<float, 3> VecImgType;
65 typedef itk::Image<itk::Vector<float,QBALL_ODFSIZE>,3>
ImageType;
66 typedef itk::ImageFileWriter<VecImgType> WriterType;
73 vecImg->SetSpacing( outimage->GetSpacing() );
74 vecImg->SetOrigin( outimage->GetOrigin() );
75 vecImg->SetDirection( outimage->GetDirection() );
76 vecImg->SetLargestPossibleRegion( outimage->GetLargestPossibleRegion());
77 vecImg->SetBufferedRegion( outimage->GetLargestPossibleRegion() );
81 itk::ImageRegionIterator<VecImgType> ot (vecImg, vecImg->GetLargestPossibleRegion() );
84 itk::ImageRegionIterator<ImageType> it (outimage, outimage->GetLargestPossibleRegion() );
89 for (it.GoToBegin(); !it.IsAtEnd(); ++it)
91 VecPixType vec = it.Get();
92 VarVecType varVec(vec.GetVnlVector().data_block(),
QBALL_ODFSIZE);
97 nrrdWriter->SetInput( vecImg );
98 nrrdWriter->SetImageIO(io);
99 nrrdWriter->SetFileName(this->GetOutputLocation().c_str());
100 nrrdWriter->UseCompressionOn();
105 nrrdWriter->Update();
107 catch (itk::ExceptionObject e)
109 std::cout << e << std::endl;
virtual ConfidenceLevel GetConfidenceLevel() const override
The confidence level of the reader or writer implementation.
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
virtual void Write() override
Write the base data to the specified location or output stream.
this class encapsulates qball images
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
map::core::discrete::Elements< 3 >::InternalImageType ImageType
virtual ~NrrdQBallImageWriter()
Convenience class to temporarily change the current locale.
static const char * GetStaticNameOfClass()
virtual mitk::NrrdQBallImageWriter * Clone() const override
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
us::ServiceRegistration< IFileWriter > RegisterService(us::ModuleContext *context=us::GetModuleContext())
ConfidenceLevel
A confidence level describing the confidence of the reader or writer in handling the given data...
Base class for writing mitk::BaseData objects to files or streams.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.