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

Parag Chandra pchandra at radonc . unc . edu
Tue, 10 Jun 2003 12:02:34 -0400


This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C32F48.2DB58F10
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Thanks. I tried out your 2nd suggestion, but because a writer has no =
output,
UpdateLargestPossibleRegion does not do anything at all =
(this->GetOutput(0)
returns NULL). I tried the 1st suggestion like so:

=20

        ImageType::Pointer image =3D
const_cast<ImageType*>(writer->GetInput());

        image->SetRequestedRegionToLargestPossibleRegion();

=20

because to me it seems that the writer's input would be the tail of the
pipeline, but this triggers the same exception. How can I manually =
change
the requested region in this case?

=20

Best regards,

Parag Chandra

=20

-----Original Message-----
From: Miller, James V (Research) [mailto:millerjv at crd . ge . com]=20
Sent: Tuesday, June 10, 2003 10:39 AM
To: 'Parag Chandra'; insight-users at public . kitware . com
Subject: RE: [Insight-users] Help with "Requested region is outside =
largest
possible region"

=20

This is standard pipeline behavior.  The requested region is cached.  =
The
first time a pipeline is run the tail of pipeline assigns the requested
region to the largest possible region.  Every subsequent execution of =
the
pipeline reuses this previous request. When something in the pipeline =
causes
a change in image size, the options are:

=20

1) Manually change the requested region for the tail of the pipeline

2) Call UpdateLargestPossibleRegion() instead of Update()

=20

In your case, I believe that you can replace the call to Write() with a =
call
to UpdateLargestPossibleRegion().

=20

=20

-----Original Message-----
From: Parag Chandra [mailto:pchandra at radonc . unc . edu]
Sent: Tuesday, June 10, 2003 10:58 AM
To: insight-users at public . kitware . com
Subject: [Insight-users] Help with "Requested region is outside largest
possible region"

Hi,

=20

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,=20

=20

typedef itk::Image<double, 2> ImageType;=20

typedef itk::ImageFileReader<ImageType> ImageReaderType;

typedef itk::ImageFileWriter<ImageType> ImageWriterType;

typedef itk::NormalizeImageFilter<ImageType, ImageType> FilterType;

ImageReaderType::Pointer reader =3D ImageReaderType::New();

ImageWriterType::Pointer writer =3D ImageWriterType::New();

FilterType::Pointer filter =3D FilterType::New();

=20

// Block 1

reader->SetFileName("beam6.mha");

filter->SetInput(reader->GetOutput());

writer->SetInput(filter->GetOutput());

writer->SetFileName("image1.mha");

writer->Write();

=20

// Block 2

reader->SetFileName("beam8.mha");

writer->SetFileName("image2.mha");

writer->Write();

=20

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.

=20

Best regards,

Parag Chandra


------=_NextPart_000_0008_01C32F48.2DB58F10
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">

<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.emailstyle17
	{font-family:Arial;
	color:windowtext;}
span.EmailStyle18
	{font-family:Arial;
	color:navy;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Thanks. I tried out your =
2<sup>nd</sup> suggestion,
but because a writer has no output, UpdateLargestPossibleRegion does not =
do
anything at all (this-&gt;GetOutput(0) returns NULL). I tried the =
1<sup>st</sup>
suggestion like so:</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;
ImageType::Pointer image =3D =
const_cast&lt;ImageType*&gt;(writer-&gt;GetInput());</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;
image-&gt;SetRequestedRegionToLargestPossibleRegion();</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>because to me it seems that the =
writer&#8217;s
input would be the tail of the pipeline, but this triggers the same =
exception.
How can I manually change the requested region in this =
case?</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Best regards,</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Parag Chandra</span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma'>-----Original =
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> Miller, James V =
(Research)
[mailto:millerjv at crd . ge . com] <br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> </span></font><font =
size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma'>Tuesday, June
 10, 2003</span></font><font size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;
font-family:Tahoma'> </span></font><font size=3D2 face=3DTahoma><span
 style=3D'font-size:10.0pt;font-family:Tahoma'>10:39 =
AM</span></font><font
size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma'><br>
<b><span style=3D'font-weight:bold'>To:</span></b> 'Parag Chandra';
insight-users at public . kitware . com<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> RE: =
[Insight-users] Help
with &quot;Requested region is outside largest possible =
region&quot;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
color=3Dblue face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:blue'>This is standard =
pipeline
behavior.&nbsp; The requested region is cached.&nbsp; The first time a =
pipeline
is run the tail of pipeline assigns the requested region to the largest
possible region.&nbsp; Every subsequent execution of the pipeline reuses =
this
previous request. When something in the pipeline causes a change in =
image size,
the options are:</span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
color=3Dblue face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:blue'>1) Manually =
change the
requested region for the tail of the pipeline</span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
color=3Dblue face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:blue'>2) Call
UpdateLargestPossibleRegion() instead of Update()</span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
color=3Dblue face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:blue'>In your case, I =
believe
that you can replace the call to Write() with a call to
UpdateLargestPossibleRegion().</span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<blockquote =
style=3D'margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>

<p class=3DMsoNormal =
style=3D'margin-right:0in;margin-bottom:12.0pt;margin-left:
.5in'><font size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma'>-----Original
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> Parag Chandra
[mailto:pchandra at radonc . unc . edu]<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> </span></font><font =
size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma'>Tuesday, June
 10, 2003</span></font><font size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;
font-family:Tahoma'> </span></font><font size=3D2 face=3DTahoma><span
 style=3D'font-size:10.0pt;font-family:Tahoma'>10:58 =
AM</span></font><font
size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma'><br>
<b><span style=3D'font-weight:bold'>To:</span></b>
insight-users at public . kitware . com<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> [Insight-users] =
Help with
&quot;Requested region is outside largest possible =
region&quot;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Hi,</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>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, </span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>typedef =
itk::Image&lt;double, 2&gt;
ImageType; </span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>typedef
itk::ImageFileReader&lt;ImageType&gt; ImageReaderType;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>typedef
itk::ImageFileWriter&lt;ImageType&gt; ImageWriterType;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>typedef
itk::NormalizeImageFilter&lt;ImageType, ImageType&gt; =
FilterType;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>ImageReaderType::Pointer =
reader =3D
ImageReaderType::New();</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>ImageWriterType::Pointer =
writer =3D
ImageWriterType::New();</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>FilterType::Pointer filter =
=3D
FilterType::New();</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>// Block =
1</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>reader-&gt;SetFileName(&quot=
;beam6.mha&quot;);</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>filter-&gt;SetInput(reader-&=
gt;GetOutput());</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>writer-&gt;SetInput(filter-&=
gt;GetOutput());</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>writer-&gt;SetFileName(&quot=
;image1.mha&quot;);</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>writer-&gt;Write();</span></=
font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>// Block =
2</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>reader-&gt;SetFileName(&quot=
;beam8.mha&quot;);</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>writer-&gt;SetFileName(&quot=
;image2.mha&quot;);</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>writer-&gt;Write();</span></=
font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>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.</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Best =
regards,</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Parag =
Chandra</span></font></p>

</blockquote>

</div>

</body>

</html>

------=_NextPart_000_0008_01C32F48.2DB58F10--