[Insight-users] large image matrix

Thorsten W. jumpfunky at web.de
Mon Oct 6 16:57:00 EDT 2008


Hello ITK-Users,

i'm new on ITK and my english skills are not the best ;)

Within the scope of a research projekt, i have to work with very large
dicom images, or that is to say 2^16 * 2^16 * 24bit.

I want to create a picture with the above-mentioned resolution with itk
and write it to disk.

But the highest resolution without allokation errors is under 
Windows ~ 2^14 * 2^14 and under Linux ~ 20000*20000...

My computer has 2 gigabyte ram. Windows XP and Ubuntu Hardy Heron are
both 32bit.

Can someone help me to create a image with the resolution 2^16 * 2^16 *
24bit?

Sincerly,
Thorsten from germany :)

#include "itkImage.h"
#include "itkImageFileWriter.h"
#include "itkGDCMImageIO.h"
#include "itkRGBPixel.h"
#include <iostream>

int main()

{

  typedef itk::RGBPixel<unsigned char> PixelType;
  typedef itk::Image< PixelType, 2 > ImageType;
  typedef itk::ImageFileWriter<ImageType> WriterType;
  typedef itk::GDCMImageIO ImageType2;

  ImageType::Pointer image = ImageType::New();
  WriterType::Pointer writer = WriterType::New();
  ImageType2::Pointer dicomio = ImageType2::New();
  ImageType::IndexType start;

  start[0] = 0;
  start[1] = 0;

  ImageType::SizeType size;

  size[0] = 20000;
  size[1] = 20000;

  ImageType::RegionType region;
  region.SetSize(size);
  region.SetIndex(start);

  image->SetRegions(region);

  try
  {
        image->Allocate();
  }

  catch (itk::ExceptionObject &excp)
  {
        std::cerr << "Exception thrown while 0" << std::endl;
        std::cerr << excp << std::endl;
  }

  ImageType::SpacingType spacing;
  spacing[0] = 1;
  spacing[1] = 1;
  image->SetSpacing(spacing);

  ImageType::PointType origin;
  origin[0] = 0;
  origin[1] = 0;
  image->SetOrigin(origin);

  writer->SetFileName("/home/thorsten/bla.dcm");
  writer->SetInput(image);
  writer->SetImageIO(dicomio);

  try
  {
        writer->Update();
  }
  catch (itk::ExceptionObject &excp)
  {
        std::cerr << "Exception thrown while 0" << std::endl;
        std::cerr << excp << std::endl;
  }
  return 0;
}



More information about the Insight-users mailing list