[Insight-users] Error even after fixing ITK bug / CombiningImageSeriesReader and RawImageIO

Andreas Keil andreas.keil at cs.tum.edu
Fri Mar 9 11:49:55 EST 2007


Hi Xabi,

thank you for your hint. Your are probably right that specifying
	io->SetFileDimensionality(2);
is correct. Unfortunately, this does not help. I still get the same error
of only reading one file.

Andreas


-----Original Message-----
From: insight-users-bounces+andreas.keil=cs.tum.edu at itk.org
[mailto:insight-users-bounces+andreas.keil=cs.tum.edu at itk.org] On Behalf
Of Xabier Artaechevarria Artieda
Sent: Friday, March 09, 2007 17:17
To: insight-users at itk.org
Subject: Re: [Insight-users] Error even after fixing ITK bug /
CombiningImageSeriesReader and RawImageIO

Hi Andreas,
I think the following line could solve the problem:

io->SetFileDimensionality(Dimension);

Good luck,
Xabi

-- 
Xabier Artaechevarria
Cancer Imaging Laboratory
Centre for Applied Medical Research
www.cima.es



Andreas Keil <andreas.keil at cs.tum.edu> ha escrito:

> Hello,
>
> I'd like to read image data from a series of raw files containing a 2D
> slice each, e.g. a 620x480x191 voxel volume in the files "data.001" to
> "data.191". Therefore, I set up an ImageSeriesReader and a RawImageIO in
> the following way:
>
>
-------------------------------------------------------------------------
> #include "itkImage.h"
> #include "itkImageSeriesReader.h"
> #include "itkRawImageIO.h"
> #include "itkNumericSeriesFileNames.h"
>
> typedef float PixelType;
> const int Dimension = 3;
> typedef itk::Image<PixelType, Dimension> ImageType;
> ImageType::Pointer itkImg = ImageType::New();
>
> typedef itk::ImageSeriesReader<ImageType> ReaderType;
> ReaderType::Pointer reader = ReaderType::New();
>
> typedef itk::RawImageIO<PixelType, Dimension> ImageIOType;
> ImageIOType::Pointer io = ImageIOType::New();
>
> io->SetDimensions(0, 620);
> io->SetDimensions(1, 480);
> io->SetDimensions(2, 191);
> io->SetSpacing(0, 1.0);
> io->SetSpacing(1, 1.0);
> io->SetSpacing(2, 1.0);
> io->SetOrigin(0, 0.0);
> io->SetOrigin(1, 0.0);
> io->SetOrigin(2, 0.0);
> io->SetHeaderSize(0);
> io->SetByteOrderToLittleEndian();
> io->SetFileTypeToBinary();
> io->SetFileDimensionality(Dimension);
> io->SetPixelType(itk::ImageIOBase::SCALAR);
> io->SetNumberOfComponents(1);
>
> typedef itk::NumericSeriesFileNames NameGeneratorType;
> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
> nameGenerator->SetSeriesFormat("data.%03d");
> nameGenerator->SetStartIndex(1);
> nameGenerator->SetEndIndex(191);
>
> reader->SetImageIO(io);
> reader->SetFileNames(nameGenerator->GetFileNames());
>
> // read image into ITK image
> reader->Update();
> itkImg = reader->GetOutput();
>
-------------------------------------------------------------------------
>
> However, even after fixing a bug (which I'll report asap) in
> itkImageSeriesReader.txx where the two lines
>
>     dimSize[m_NumberOfDimensionsInImage] = m_FileNames.size();
>     spacing[m_NumberOfDimensionsInImage] = interSliceSpacing;
>
> had to be fixed by adding -1 in the index, I still can't read an image
> series with RawImageIO. I get an ITK exception telling me that only one
> 1190400 bytes could be read (which is the size of one slice) instead of
> 227366400 bytes (which is the whole volume's size). It seems to me that
> the RawImageIO object wants to read all data from the first file, which
> is, of course, impossible. How can I tell the
ImageSeriesReader/RawImageIO
> that I want to read the input from all 191 files?
>
> Thank you,
> Andreas.
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>



----------------------------------------------------------------
Este mensaje ha sido enviado desde https://webmail.unav.es

_______________________________________________
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