15 #ifndef __itkImageFileCastWriter_h
16 #define __itkImageFileCastWriter_h
18 #include "itkImageFileWriter.h"
19 #include "itkImageIOBase.h"
20 #include "itkExceptionObject.h"
22 #include "itkImageIORegion.h"
23 #include "itkCastImageFilter.h"
37 template <
class TInputImage >
64 itkSetStringMacro(OutputComponentType);
65 itkGetStringMacro(OutputComponentType);
81 template <
class OutputComponentType >
83 const OutputComponentType & itkNotUsed( dummy ) )
85 typedef Image< OutputComponentType, InputImageDimension> DiskImageType;
86 typedef typename PixelTraits<InputImagePixelType>::ValueType InputImageComponentType;
87 typedef Image<InputImageComponentType, InputImageDimension> ScalarInputImageType;
88 typedef CastImageFilter< ScalarInputImageType, DiskImageType> CasterType;
91 this->GetImageIO()->SetPixelTypeInfo(
typeid(OutputComponentType) );
94 typename CasterType::Pointer caster = CasterType::New();
96 typename ScalarInputImageType::Pointer localInputImage = ScalarInputImageType::New();
97 localInputImage->Graft( inputImage );
98 caster->SetInput( localInputImage );
102 OutputComponentType * pixelBuffer = caster->GetOutput()->GetBufferPointer();
103 void * convertedBuffer =
static_cast<void *
>(pixelBuffer);
104 return convertedBuffer;
119 #ifndef ITK_MANUAL_INSTANTIATION
120 #include "itkImageFileCastWriter.txx"
123 #endif // __itkImageFileCastWriter_h
Superclass::InputImageType InputImageType
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
Casts pixel type and writes image data.
Superclass::InputImagePixelType InputImagePixelType
std::string m_OutputComponentType
ImageFileWriter< TInputImage > Superclass
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)