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

Miller, James V (Research) millerjv at crd . ge . com
Tue, 10 Jun 2003 11:39:04 -0400


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C32F65.FE9C32BB
Content-Type: text/plain

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:
 
1) Manually change the requested region for the tail of the pipeline
2) Call UpdateLargestPossibleRegion() instead of Update()
 
In your case, I believe that you can replace the call to Write() with a call
to UpdateLargestPossibleRegion().
 
 

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

 

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


------_=_NextPart_001_01C32F65.FE9C32BB
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">


<META content="MSHTML 6.00.2800.1141" name=GENERATOR>
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
	COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
	COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
	COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
	COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
	COLOR: windowtext; FONT-FAMILY: Arial
}
DIV.Section1 {
	page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV><SPAN class=592003615-10062003><FONT face=Arial color=#0000ff size=2>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:</FONT></SPAN></DIV>
<DIV><SPAN class=592003615-10062003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=592003615-10062003><FONT face=Arial color=#0000ff size=2>1) 
Manually change the requested region for the tail of the 
pipeline</FONT></SPAN></DIV>
<DIV><SPAN class=592003615-10062003><FONT face=Arial color=#0000ff size=2>2) 
Call UpdateLargestPossibleRegion() instead of Update()</FONT></SPAN></DIV>
<DIV><SPAN class=592003615-10062003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=592003615-10062003><FONT face=Arial color=#0000ff size=2>In 
your case, I believe that you can replace the call to Write() with a call to 
UpdateLargestPossibleRegion().</FONT></SPAN></DIV>
<DIV><SPAN class=592003615-10062003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=592003615-10062003></SPAN>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Parag Chandra 
  [mailto:pchandra at radonc . unc . edu]<BR><B>Sent:</B> Tuesday, June 10, 2003 10:58 
  AM<BR><B>To:</B> insight-users at public . kitware . com<BR><B>Subject:</B> 
  [Insight-users] Help with "Requested region is outside largest possible 
  region"<BR><BR></FONT></DIV>
  <DIV class=Section1>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi,</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; 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=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">typedef itk::Image&lt;double, 
  2&gt; ImageType; </SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">typedef 
  itk::ImageFileReader&lt;ImageType&gt; ImageReaderType;</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">typedef 
  itk::ImageFileWriter&lt;ImageType&gt; ImageWriterType;</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">typedef 
  itk::NormalizeImageFilter&lt;ImageType, ImageType&gt; 
  FilterType;</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">ImageReaderType::Pointer reader = 
  ImageReaderType::New();</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">ImageWriterType::Pointer writer = 
  ImageWriterType::New();</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">FilterType::Pointer filter = 
  FilterType::New();</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">// Block 1</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">reader-&gt;SetFileName("beam6.mha");</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">filter-&gt;SetInput(reader-&gt;GetOutput());</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">writer-&gt;SetInput(filter-&gt;GetOutput());</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">writer-&gt;SetFileName("image1.mha");</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">writer-&gt;Write();</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">// Block 2</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">reader-&gt;SetFileName("beam8.mha");</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">writer-&gt;SetFileName("image2.mha");</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">writer-&gt;Write();</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; 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=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Best regards,</SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Parag 
  Chandra</SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C32F65.FE9C32BB--