18#ifndef __itkImageFileCastWriter_h
19#define __itkImageFileCastWriter_h
21#include "itkImageFileWriter.h"
22#include "itkImageIOBase.h"
25#include "itkImageIORegion.h"
26#include "itkCastImageFilter.h"
39template<
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->GetModifiableImageIO()->SetPixelTypeInfo(
static_cast< const OutputComponentType *
>( 0 ) );
99 typename CasterType::Pointer caster = CasterType::New();
100 this->m_Caster = caster;
101 typename ScalarInputImageType::Pointer localInputImage = ScalarInputImageType::New();
103 localInputImage->Graft(
static_cast< const ScalarInputImageType *
>(inputImage) );
105 caster->SetInput( localInputImage );
109 OutputComponentType * pixelBuffer = caster->GetOutput()->GetBufferPointer();
110 void * convertedBuffer =
static_cast< void *
>( pixelBuffer );
111 return convertedBuffer;
127#ifndef ITK_MANUAL_INSTANTIATION
128#include "itkImageFileCastWriter.hxx"
Casts pixel type and writes image data.
itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension)
ImageFileCastWriter(const Self &)
std::string m_OutputComponentType
SmartPointer< const Self > ConstPointer
void GenerateData(void) override
Superclass::InputImagePointer InputImagePointer
ProcessObject::Pointer m_Caster
Superclass::InputImageType InputImageType
void * ConvertScalarImage(const DataObject *inputImage, const OutputComponentType &)
SmartPointer< Self > Pointer
void operator=(const Self &)
Superclass::InputImageRegionType InputImageRegionType
~ImageFileCastWriter() override
ImageFileWriter< TInputImage > Superclass
Superclass::InputImagePixelType InputImagePixelType
std::string GetDefaultOutputComponentType(void) const