[ITK-users] Images and Array

Jerome Plumat j.plumat at auckland.ac.nz
Sun Nov 16 23:10:52 EST 2014


Hi everyone,
I'm facing to a problem and I would like your opinions. I would like to 
create and to save a 4D image with dynamic voxel sizes.

My current solution involves itk::Array

typedef float ArrayValType;
typedef itk::Array< ArrayValType > ArrayType;
typedef itk::Image< ArrayType, Dimension > ImageArrayType;

That solves the unknown length of the voxels (while itk::Vector needs to 
know it before compiling).

When I create and save this volume, no error is displayed but the file 
is "empty" (the header is present but no data).
The corresponding code is, in a dedicated object:

typedef unsigned short   OutputPixelType;
typedef itk::Array< OutputPixelType > ArrayType;
typedef typename itk::Image<ArrayType, Dimension> OutputImageType;
typedef itk::ImageFileWriter< OutputImageType > MetaWriterType;

typedef itk::CastImageFilter< InputImageType, OutputImageType 
 >CastFilterType;
typename CastFilterType::Pointer cast = CastFilterType::New();
cast->SetInput( m_vol );

typename MetaWriterType::Pointer writer = MetaWriterType::New();
writer->SetFileName( m_path );
writer->SetInput( cast->GetOutput() );
writer->Update();

where InputImageType = ImageArrayType

Does this strategy should work?
Do I need to implement my own writer? Do you know some other solutions?

Thanks in advance.

-- 

Jerome Plumat
-------
School of Medical Sciences
University of Auckland

If I am not for myself, who will be for me? And if I am only for myself, then what an I? And if not now when? – Hillel HaZaken



More information about the Insight-users mailing list