[ITK] [ITK-users] Images and Array

Jim Miller millerjv at gmail.com
Mon Nov 17 06:57:54 EST 2014


It sounds like you want to use the VectorImage type. VectorImage allows the lengths of the vectors to be specified at runtime. 

Formats like MetaIO and NRRD  will support this format. 

Jim

> On Nov 16, 2014, at 11:10 PM, Jerome Plumat <j.plumat at auckland.ac.nz> wrote:
> 
> 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
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list