[Insight-users] non-uniform sampling and 4D data

karthik krishnan karthik.krishnan at kitware.com
Tue Oct 31 10:28:36 EST 2006


ahmed saad wrote:

> Hi,
>
>     I deal with time-varying medical image data [3D+Time]. My program 
> should open both 3D/4D datasets and also with different data types 
> (unsigned char – char – float) from different medical image file formats.
>
>  
>
> * The first problem I faced that ITK image is templated over <the 
> pixel type and image dimension>. So I have to define them in compile 
> time. But I don’t know this information in the compile time. I have to 
> read the file header first (Analyze – minc….). So how Can I solve this 
> problem?
>
All imageIO's in ITK support a ReadImageInformation() method that reads 
the headers alone and sets appropriate parameters. One of those 
parameters is the data type. Calling the reader's 
UpdateOutputInformation() method will delegate the task of reading the 
image headers to the ImageIO. Once you do that, you will need to read 
your images in a second pass, with the appropriate reader templated over 
the appropriate image type.

Typically your application then will be templated too..

Your code will look something like this:

typedef itk::ImageFileReader< itk::Image< unsigned char , 3 > > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->UpdateOutputInformation();

switch ( reader->GetImageIO()->GetComponentType() )
{
   case ImageIOBase::USHORT:
      typedef itk::ImageFileReader< itk::Image< unsigned short, 3 > > 
ActualReaderType;
      ActualReaderType::Pointer areader = ReaderType::New();
      areader->Update();  // does the actual read
      YourApplication< unsigned short > *app = new  YourApplication< 
unsigned short >();
      app->Run();
   
   case ImageIOBase::UCHAR:
....

> * The second problem is my datasets are non-uniform sampled in time 
> domain. For example the first 3D volume at t = 2 seconds and the 
> second 3D volume at 10 seconds and the third volume at 30 seconds and 
> so on. So can ITK deal with non-uniform sampling in time  domain.
>
No ITK does not have a datastructure to represent rectilinear grids.
VTK does. See vtkRectilinearGridReader, vtkRectilinearGrid.

-karthik

>  
>
> Thanks in advance.
>
>  
>
> Best regards,
>
> Ahmed Saad
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>  
>



More information about the Insight-users mailing list