17 #ifndef __mitkNrrdTbssImageWriter__cpp
18 #define __mitkNrrdTbssImageWriter__cpp
21 #include "itkMetaDataDictionary.h"
22 #include "itkMetaDataObject.h"
23 #include "itkNrrdImageIO.h"
25 #include "itkImageFileWriter.h"
26 #include "itksys/SystemTools.hxx"
27 #include "boost/lexical_cast.hpp"
34 : m_FileName(
""), m_FilePrefix(
""), m_FilePattern(
""), m_Success(false)
36 this->SetNumberOfRequiredInputs( 1 );
49 itkWarningMacro(<<
"Sorry, input to NrrdTbssImageWriter is NULL!");
52 if ( m_FileName ==
"" )
54 itkWarningMacro( <<
"Sorry, filename has not been set!" );
75 std::vector< std::pair <std::string, int> > groups = input->
GetGroupInfo();
76 auto it = groups.begin();
79 while(it != groups.end())
81 std::pair<std::string, int> p = *it;
83 key =
"Group_index_" + boost::lexical_cast<std::string>(i);
84 val =
" " + p.first +
" " + boost::lexical_cast<std::string>(p.second);
91 itk::EncapsulateMetaData< std::string >(input->
GetImage()->GetMetaDataDictionary(),key,val);
96 key =
"Measurement info";
98 itk::EncapsulateMetaData< std::string >(input->
GetImage()->GetMetaDataDictionary(),key,val);
104 typedef itk::VectorImage<float,3>
ImageType;
107 io->SetFileType( itk::ImageIOBase::Binary );
108 io->UseCompressionOn();
111 typedef itk::ImageFileWriter<ImageType> WriterType;
113 nrrdWriter->UseInputMetaDataDictionaryOn();
114 nrrdWriter->SetInput( img );
115 nrrdWriter->SetImageIO(io);
116 nrrdWriter->SetFileName(m_FileName);
117 nrrdWriter->UseCompressionOn();
118 nrrdWriter->SetImageIO(io);
121 nrrdWriter->Update();
123 catch (itk::ExceptionObject e)
125 std::cout << e << std::endl;
136 this->ProcessObject::SetNthInput( 0, tbssVol );
142 if ( this->GetNumberOfInputs() < 1 )
148 return dynamic_cast<InputType*
> ( this->ProcessObject::GetInput( 0 ) );
155 std::vector<std::string> possibleFileExtensions;
156 possibleFileExtensions.push_back(
".tbss");
157 return possibleFileExtensions;
165 #endif //__mitkNrrdTbssImageWriter__cpp
virtual void GenerateData() override
itk::SmartPointer< Self > Pointer
virtual ~NrrdTbssImageWriter()
map::core::discrete::Elements< 3 >::InternalImageType ImageType
static const char * GetStaticNameOfClass()
std::string GetMeasurementInfo()
void SetInput(InputType *input)
ImageType::Pointer GetImage()
std::string GetSupportedBaseData() const override
this class encapsulates diffusion volumes (vectorimages not yet supported by mitkImage) ...
virtual std::vector< std::string > GetPossibleFileExtensions() override
std::vector< std::pair< std::string, int > > GetGroupInfo()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.