[Insight-users] Reading Analyze 7.5 images with ITK

Bill Lorensen bill.lorensen at gmail.com
Sun Nov 8 16:23:31 EST 2009


Place a try/catch block around the reader->Update() and print the
exception if one is thrown.

  try
    {
    reader->Update();
    }
  catch (itk::ExceptionObject &e)
    {
    std::cerr << e << std::endl;
    return EXIT_FAILURE;
    }


On Sun, Nov 8, 2009 at 3:40 PM, A.Burak Yoldemir <yoldemir at gmail.com> wrote:
> Hello,
>
> I am trying to read Analyze 7.5 images using ITK, however I am getting
> segfault. Here is the relevant code:
>
>             typedef unsigned char PixelType;
>             const unsigned int Dimension = 3;
>             typedef itk::Image< PixelType, Dimension > ImageType;
>
>             typedef itk::ImageSeriesReader< ImageType > ReaderType;
>
>             ReaderType::Pointer reader = ReaderType::New();
>
>             typedef itk::NumericSeriesFileNames    NameGeneratorType;
>             NameGeneratorType::Pointer nameGenerator =
> NameGeneratorType::New();
>
>             nameGenerator->SetSeriesFormat(
> "/root/Desktop/default_10-v1.0.3/default_10-v1.0.3/phantom_01/clean/dwi-%02d.hdr"
> );
>
>             nameGenerator->SetStartIndex( 0 );
>             nameGenerator->SetEndIndex( 66 );
>             nameGenerator->SetIncrementIndex( 1 );
>
>             reader->SetImageIO( itk::AnalyzeImageIO::New() );
>
>             reader->SetFileNames( nameGenerator->GetFileNames() );
>             reader->Update();
>
> I am getting a segmentation fault when the update method is called. Any
> ideas?
>
> Thanks in advance,
>
>
> Ahmet Burak Yoldemi
> _____________________________________
> 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.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list