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();
102 localInputImage->Graft( inputImage );
103 caster->SetInput( localInputImage );
107 OutputComponentType * pixelBuffer = caster->GetOutput()->GetBufferPointer();
108 void * convertedBuffer =
static_cast< void *
>( pixelBuffer );
109 return convertedBuffer;
125 #ifndef ITK_MANUAL_INSTANTIATION 126 #include "itkImageFileCastWriter.hxx" 129 #endif // __itkImageFileCastWriter_h Superclass::InputImageType InputImageType
Casts pixel type and writes image data.
SmartPointer< const Self > ConstPointer
Superclass::InputImagePixelType InputImagePixelType
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
std::string GetDefaultOutputComponentType(void) const
itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension)
ImageFileWriter< TInputImage > Superclass