17 #ifndef __mitkNrrdTbssRoiImageWriter__cpp
18 #define __mitkNrrdTbssRoiImageWriter__cpp
21 #include "itkMetaDataDictionary.h"
22 #include "itkMetaDataObject.h"
23 #include "itkNrrdImageIO.h"
25 #include "itkImageFileWriter.h"
26 #include "itksys/SystemTools.hxx"
33 : m_FileName(
""), m_FilePrefix(
""), m_FilePattern(
""), m_Success(false)
35 this->SetNumberOfRequiredInputs( 1 );
49 itkWarningMacro(<<
"Sorry, input to NrrdTbssImageWriter is NULL!")
52 if ( m_FileName ==
"" )
54 itkWarningMacro( <<
"Sorry, filename has not been set!" )
62 std::vector< itk::Index<3> > roi = input->
GetRoi();
64 auto it = roi.begin();
67 while(it != roi.end())
71 sprintf( keybuffer,
"ROI_index_%04d", i );
72 sprintf( valbuffer,
"%ld %ld %ld", ix[0],ix[1],ix[2]);
74 std::cout << valbuffer << std::endl;
78 itk::EncapsulateMetaData< std::string >(input->
GetImage()->GetMetaDataDictionary(), std::string(keybuffer), std::string(valbuffer));
85 itk::EncapsulateMetaData< std::string >(input->
GetImage()->GetMetaDataDictionary(),
"structure", structure);
87 typedef itk::Image<unsigned char,3>
ImageType;
91 io->SetFileType( itk::ImageIOBase::Binary );
92 io->UseCompressionOn();
95 typedef itk::ImageFileWriter<ImageType> WriterType;
97 nrrdWriter->UseInputMetaDataDictionaryOn();
98 nrrdWriter->SetInput( img );
99 nrrdWriter->SetImageIO(io);
100 nrrdWriter->SetFileName(m_FileName);
102 nrrdWriter->SetImageIO(io);
105 nrrdWriter->Update();
107 catch (itk::ExceptionObject e)
109 std::cout << e << std::endl;
118 this->ProcessObject::SetNthInput( 0, tbssVol );
124 if ( this->GetNumberOfInputs() < 1 )
130 return dynamic_cast<InputType*
> ( this->ProcessObject::GetInput( 0 ) );
137 std::vector<std::string> possibleFileExtensions;
138 possibleFileExtensions.push_back(
".roi");
139 return possibleFileExtensions;
147 #endif //__mitkNrrdTbssRoiImageWriter__cpp
itk::SmartPointer< Self > Pointer
this class encapsulates diffusion volumes (vectorimages not yet supported by mitkImage) ...
void SetInput(InputType *input)
virtual void GenerateData() override
virtual std::vector< std::string > GetPossibleFileExtensions() override
virtual ~NrrdTbssRoiImageWriter()
std::string GetSupportedBaseData() const override
ImageType::Pointer GetImage()
virtual std::string GetStructure()
map::core::discrete::Elements< 3 >::InternalImageType ImageType
static const char * GetStaticNameOfClass()
std::vector< itk::Index< 3 > > GetRoi()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.