18 #ifndef __itkImageFileCastWriter_h 19 #define __itkImageFileCastWriter_h 21 #include "itkImageFileWriter.h" 22 #include "itkImageIOBase.h" 23 #include "itkExceptionObject.h" 25 #include "itkImageIORegion.h" 26 #include "itkCastImageFilter.h" 39 template<
class TInputImage >
67 itkSetStringMacro( OutputComponentType );
68 itkGetStringMacro( OutputComponentType );
85 template<
class OutputComponentType >
87 const OutputComponentType & itkNotUsed( dummy ) )
90 typedef typename PixelTraits< InputImagePixelType >::ValueType InputImageComponentType;
92 typedef CastImageFilter< ScalarInputImageType, DiskImageType > CasterType;
96 this->GetImageIO()->SetPixelTypeInfo( static_cast< const OutputComponentType * >( 0 ) );
99 typename CasterType::Pointer caster = CasterType::New();
101 typename ScalarInputImageType::Pointer localInputImage = ScalarInputImageType::New();
103 #if ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 11 104 localInputImage->Graft( static_cast< const ScalarInputImageType * >(inputImage) );
106 localInputImage->Graft( inputImage );
109 caster->SetInput( localInputImage );
113 OutputComponentType * pixelBuffer = caster->GetOutput()->GetBufferPointer();
114 void * convertedBuffer =
static_cast< void *
>( pixelBuffer );
115 return convertedBuffer;
131 #ifndef ITK_MANUAL_INSTANTIATION 132 #include "itkImageFileCastWriter.hxx" 135 #endif // __itkImageFileCastWriter_h Superclass::InputImageType InputImageType
Casts pixel type and writes image data.
SmartPointer< const Self > ConstPointer
Superclass::InputImagePixelType InputImagePixelType
std::string GetDefaultOutputComponentType(void) const
std::string m_OutputComponentType
SmartPointer< Self > Pointer
void operator=(const Self &)
void * ConvertScalarImage(const DataObject *inputImage, const OutputComponentType &)
Superclass::InputImageRegionType InputImageRegionType
Superclass::InputImagePointer InputImagePointer
ProcessObject::Pointer m_Caster
itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension)
ImageFileWriter< TInputImage > Superclass