[Insight-users] Help with "Requested region is outside largest possible region"

Luis Ibanez luis . ibanez at kitware . com
Wed, 11 Jun 2003 16:54:53 -0400


Hi Parag,

A fix has been checked in itkImageFileWriter.txx
http://www . itk . org/cgi-bin/cvsweb . cgi/Insight/Code/IO/itkImageFileWriter . txx . diff?r1=1 . 24&r2=1 . 25&cvsroot=Insight&sortby=date

It checks now if he IORegion has been set by the
user. If it is not the case, it triggers a call
to UpdateLargestPossibleRegion() on the source of
the input image. (before an Update() call was used).


Please let us know if find further problems,


   Thanks


     Luis


------------------------
Parag Chandra wrote:
> Hi Luis,
> 
> Your suggestion does work fine for most filters, though
> UpdateLargestPossibleRegion() does nothing when called on a writer. Since
> the writer has no output, the call to GetOutput() returns NULL and the if
> block is never executed. Is there some approach that will do the same for
> writers (and other sinks that have no output) ?
> 
> -Parag
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis . ibanez at kitware . com] 
> Sent: Wednesday, June 11, 2003 9:58 AM
> To: Parag Chandra
> Cc: 'Stephen R. Aylward'; 'Parag Chandra'; insight-users at public . kitware . com
> Subject: Re: [Insight-users] Help with "Requested region is outside largest
> possible region"
> 
> 
> 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
>>>
>>
>>
>>
> 
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at www . itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>