[Insight-users] Help with "Requested region is outside largest
possible region"
Luis Ibanez
luis . ibanez at kitware . com
Wed, 11 Jun 2003 10:57:41 -0400
Hi Parag,
When an ITK filter is run once with an input image
and then you try to run it a second time with an
input image of different size, you have to invoke
the method
UpdateLargestPossibleRegion()
instead of the usual
Update()
The reason is that the region negociations are
cached during the first time the filter is executed.
The pipeline assumes that the regions are valid for
subsequent executions.
The method UpdateLargestPossibleRegion() forces the
pipeline to repeat the region negociation.
Regards,
Luis
--------------------------
Parag Chandra wrote:
> Just tried the CVS version and I still get the same error. The only
> workaround I've found so far is to actually create a new filter:
>
> reader->SetFileName("beam6.fm");
> filter->SetInput(reader->GetOutput());
> writer->SetInput(filter->GetOutput());
> writer->SetFileName("image1.fm");
> writer->Write();
>
> reader->SetFileName("beam8.fm");
> filter = FilterType::New();
> filter->SetInput(reader->GetOutput());
> writer->SetInput(filter->GetOutput());
> writer->SetFileName("image2.fm");
> writer->Write();
>
> Now my question is if I do this, have I completely disconnected the old
> filter so that there will be no more references to it and the object will be
> destroyed?
>
> -----Original Message-----
> From: Stephen R. Aylward [mailto:aylward at unc . edu]
> Sent: Tuesday, June 10, 2003 11:16 AM
> To: Parag Chandra
> Cc: insight-users at public . kitware . com
> Subject: Re: [Insight-users] Help with "Requested region is outside largest
> possible region"
>
> Hi,
>
> I think Julien fixed this in the CVS version. Are you using a checkout
> from within the past week?
>
> Stephen
>
> Parag Chandra wrote:
>
>>Hi,
>>
>>
>>
>>I am getting the error above every time I try to reuse a filter with an
>>image that is smaller than the image I previously processed with that
>>filter. For example,
>>
>>
>>
>>typedef itk::Image<double, 2> ImageType;
>>
>>typedef itk::ImageFileReader<ImageType> ImageReaderType;
>>
>>typedef itk::ImageFileWriter<ImageType> ImageWriterType;
>>
>>typedef itk::NormalizeImageFilter<ImageType, ImageType> FilterType;
>>
>>ImageReaderType::Pointer reader = ImageReaderType::New();
>>
>>ImageWriterType::Pointer writer = ImageWriterType::New();
>>
>>FilterType::Pointer filter = FilterType::New();
>>
>>
>>
>>// Block 1
>>
>>reader->SetFileName("beam6.mha");
>>
>>filter->SetInput(reader->GetOutput());
>>
>>writer->SetInput(filter->GetOutput());
>>
>>writer->SetFileName("image1.mha");
>>
>>writer->Write();
>>
>>
>>
>>// Block 2
>>
>>reader->SetFileName("beam8.mha");
>>
>>writer->SetFileName("image2.mha");
>>
>>writer->Write();
>>
>>
>>
>>The first block executes with no problem. beam6.mha is 53x63 in size,
>>while beam8.mha is 50x63. The second block triggers an exception in
>>DataObject::PropagateRequestedRegion because
>>ImageBase::VerifyRequestedRegion returns false. For some reason, the
>>second time the filter is run it uses the same requested region as the
>>first time it ran (53x63), but this time around, the image is only
>>50x63. Does anyone know what is going on? I am using ITK release 1.2, so
>>if this has been fixed in CVS, please let me know what the workaround
>>is. Thanks.
>>
>>
>>
>>Best regards,
>>
>>Parag Chandra
>>
>
>
>