[ITK] [ITK-users] itkImageFileWriter + ExtractSliceImageFilter: largest region exception

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Sep 8 10:16:04 EDT 2015


Hello,

What is the buffered region for the input image? Is the input image connected to a pipeline?

Perhaps you just forgot to update the input image before running this function?

Brad

On Sep 7, 2015, at 5:21 PM, Marcos <fotosentido at gmail.com> wrote:

> Hi,
> 
> I have a method that was exporting fine one frame from my itk::Image.
> 
> My method:
> 
> void Exporter::exportOriginal(QString fileName, ImageType::Pointer image, int frame)
> {
>     typedef itk::ImageFileWriter<FrameImageType> WriterType;
>     WriterType::Pointer writer = WriterType::New();
> 
>     writer->SetFileName(fileName.toStdString().c_str());
> 
>     ImageType::RegionType inputRegion = image->GetLargestPossibleRegion();
> 
>     ImageType::IndexType index = inputRegion.GetIndex();
>     ImageType::SizeType size = inputRegion.GetSize();
> 
>     index[0] = 0;
>     index[1] = 0;
>     index[2] = frame;
> 
>     // 3D to 2D
>     size[2] = 0;
> 
>     ImageType::RegionType outputRegion;
>     outputRegion.SetIndex(index);
>     outputRegion.SetSize(size);
> 
>     typedef itk::Testing::ExtractSliceImageFilter<ImageType, FrameImageType> ExtractType;
>     ExtractType::Pointer extracter = ExtractType::New();
>     extracter->SetExtractionRegion(outputRegion);
> 
>     writer->SetInput(extracter->GetOutput());
>     try
>     {
>         writer->Update();
>     }
>     catch (itk::ExceptionObject &ex)
>     {
>         std:cerr << ex << std::endl;
>     }
> }
> 
> as inputRegion, I have:
> index: [0, 0, 0]
> size: [512, 512, 12]
> 
> as outputRegion, I have:
> index: [0, 0, 1]                   # first frame
> size: [512, 512, 0]
> 
> 
> 
> But I'm not sure what happened, now with every image I got an exception:
> itkimagefilewriter.hxx:287: "Largest possible region does not fully contain requested paste IO region"
> 
> By the way, my try catch is not getting the exception message, I had to look inside the writer class.
> Any ideas? Thank you.
> _____________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150908/061bdb8d/attachment-0001.html>
-------------- next part --------------
_____________________________________
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