<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=299351918-02022006><FONT face=Arial color=#0000ff size=2>Amir,
</FONT></SPAN></DIV>
<DIV><SPAN class=299351918-02022006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=299351918-02022006><FONT face=Arial color=#0000ff size=2>You
should need both the call to Update() and UpdateLargestPossibleRegion(). The
call to UpdateLargestPossibleRegion() should be fine.</FONT></SPAN></DIV>
<DIV><SPAN class=299351918-02022006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=299351918-02022006><FONT face=Arial color=#0000ff
size=2>jim</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> charfeddine amir
[mailto:charfeddine_amir@yahoo.fr]<BR><B>Sent:</B> Thursday, February 02, 2006
2:24 AM<BR><B>To:</B> Miller, James V (GE, Research); insight
insight<BR><B>Subject:</B> RE: [Insight-users] ITK exception caught in main
:itk::InvalidRequestedRegionError (0x82cb748)<BR><BR></FONT></DIV>Hi
Jim,<BR>thx very much<BR>i just add a call to the<SPAN
class=906544221-01022006><FONT face=Arial color=#0000ff size=2>
</FONT></SPAN><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2>UpdateLargestPossibleRegion() <SPAN style="COLOR: rgb(0,0,0)">method ,
and every thing was ok</SPAN>:</FONT></SPAN><SPAN
class=906544221-01022006><FONT face=Arial color=#0000ff size=2><BR>
.<BR> .<BR></FONT></SPAN> m_ImageReader->SetFileName(
FileNamesItr->c_str());<BR> m_ImageReader->Update();<BR><SPAN
class=906544221-01022006><FONT face=Arial color=#0000ff size=2>
m_ImageReader->UpdateLargestPossibleRegion()<BR> .<BR>
.<BR> <SPAN style="COLOR: rgb(0,0,0)">Regards, <BR>
Amir.<BR></SPAN></FONT></SPAN><BR><B><I>"Miller, James V (GE, Research)"
<millerjv@crd.ge.com></I></B> a écrit :
<BLOCKQUOTE class=replbq
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: 2px solid">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR>
<DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2>The problem is probably in your LoadNextImage() method.
</FONT></SPAN></DIV>
<DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2>What ImageType is ImageFileReader loading? Is it a 2D or 3D
image?</FONT></SPAN></DIV>
<DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2>When a pipeline is run the first time, it establishes a set of region
requests at each stage in the pipeline. The last filter places a
request on the filter before ! it, that filter places a request on the
filter before it, ... When you changed the filename on the reader, the
reader may no longer satisfy the request cached between it and the
downstream filters. When you change a parameter like the slice to
visualize (or the amount to shrink an image), you need to call
UpdateLargestPossibleRegion() instead of Update() on the pipeline to
renogiate the regions and ignore the previous cached
versions.</FONT></SPAN></DIV>
<DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff
size=2>Jim</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
insight-users-bounces+millerjv=crd.ge.com@itk.org!
[mailto:insight-users-bounces+millerjv=crd.ge.com@itk.org]<B>On Behalf Of
</B>charfeddine amir<BR><B>Sent:</B> Wednesday, February 01, 2006 10:37
AM<BR><B>To:</B> insight insight<BR><B>Subject:</B> [Insight-users] ITK
exception caught in main :itk::InvalidRequestedRegionError
(0x82cb748)<BR><BR></FONT></DIV>HI all<BR>i have this error and the
program crash while triying to visualize Dicom Image.<BR>this program read
all Dicom files belonging to the same serie, from a given
directory.<BR>each file contain many slice of a fantom.<BR>I take the
ShapeDetectionLevelSet program from the InsightApplications and edit it do
that.<BR>i start with pushing the Load Button, I select a dicom directory
containing files, then program read all the Dicom files belonging to the
same serie( the first one found), and read the first Dicom file, then i
can visualize it when i click on the Display Button (under Load
button),<BR>then i move to the next Dicom file! in serie with a counter
(like fltk slider), and when i reclick on display, the program crash with
the following message:<BR><BR>ITK exception caught in main
<BR><BR>itk::InvalidRequestedRegionError (0x82cb748)<BR>Location:
"Image::PropagateRequestedRegion()"<BR>File:
/usr/local/InsightToolkit-2.4.0/Code/Common/itkDataObject.c! xx<BR>Line:
397<BR>Description: Requested region is (at least partially) outside the
largest possible region.<BR><BR>this is part of code i add:<BR><BR><SPAN
style="FONT-STYLE: italic; TEXT-DECORATION: underline">//function for
loading the first serie in the directory dirname</SPAN><BR><SPAN
style="FONT-WEIGHT: bold">void</SPAN><BR style="FONT-WEIGHT: bold"><SPAN
style="FONT-WEIGHT: bold">ShapeDetectionLevelSetBase </SPAN><BR
style="FONT-WEIGHT: bold"><SPAN style="FONT-WEIGHT: bold">::<SPAN
style="TEXT-DECORATION: underline">LoadInputDir</SPAN>( const char *
dirname )</SPAN><BR>{<BR><BR>if( !dirname )<BR>
{<BR> return;<BR>
}<BR> nameGenerator->SetDirectory( dirname );<BR> seriesUID =
nameGenerator->GetSeriesUIDs();<BR> <BR> seriesIdentifier =
seriesUID.begin()->c_str();<BR> <BR>
<BR> fileNames = nameGenerator->GetFileNames(
seriesIdentifier );<!-- br--> FileNamesBegin =
fileNames.begin();<BR> FileNamesItr =
fileNames.end();<BBR> FileNamesEnd =
fileNames.end();<BR> <BR>
ListCardinal=0;<BR>
ListPosition=1;<BR> while( FileNamesItr !=
FileNamesBegin )<BR> {<BR>
ListCardinal++;<BR>
FileNamesItr--;<BR> }<BR> <BR>
LoadCurrentImage();<BR>}<BR><BR><SPAN
style="FONT-STYLE: italic; TEXT-DECORATION: underline">//function for!
reading the first file in serie</SPAN><BR><SPAN
style="FONT-WEIGHT: bold">void</SPAN><BR style="FONT-WEIGHT: bold"><SPAN
style="FONT-WEIGHT: bold">ShapeDetectionLevelSetBase </SPAN><BR
style="FONT-WEIGHT: bold"><SPAN style="FONT-WEIGHT: bold">::<SPAN
style="TEXT-DECORATION: underline">LoadCurrentImage</SPAN>()</SPAN><BR
style="FONT-WEIGHT: bold">{<BR> <BR>
m_ImageReader->SetFileName( FileNamesItr->c_str());<BR>
m_ImageReader->Update();<BR>
m_InputImage=m_ImageReader->GetOutput();<BR><BR> // Allocate an
image of seeds of the same size<BR> InputImageType::RegionType
region
<BR> =
m_ImageReader->GetOutput()->GetLargestPossibleRegion();<BR><BR>
InputImageType::SizeType size = region.GetSize();<BR><BR>
for(unsigned int i=0; i<ImageDimension; i++)<BR>
{<BR> if( size[i] < 10
)<BR> {<BR>
this->ShowStatus("Image must be 3D and with at least 10 pixels along
each Dimension.");<BR> itk::ExceptionObject
excp;<BR> excp.SetDescription("Image must be
3D and with at least 10 pixels along each
Dimension.");<BR> throw !
excp;<BR> }<BR>
}<BR><BR><BR> m_SeedImage->SetRegions( region );<BR>
m_SeedImage->Allocate();<BR> m_SeedImage->FillBuffer(
itk::NumericTraits<SeedImageType::PixelType>::Zero );<BR><BR>
m_FastMarchingFilter->SetOutputSize( region.GetSize()
);<BR><BR><BR> m_InputImageIsLoaded = true;<BR>}<BR><BR><SPAN
style="FONT-STYLE: italic; TEXT-DECORATION: underline">//function for
reading the next file in serie</SPAN><BR><SPAN
style="FONT-WEIGHT: bold">void</SPAN><BR style="FONT-WEIGHT: bold"><SPAN
style="FONT-WEIGHT: bold">ShapeDetectionLevelSetBase </SPAN><BR
style="FONT-WEIGHT: bold"><SPAN style="FONT-WEIGHT: bold">::<SPAN
style="TEXT-DECORATION: underline">LoadNextImage</SPAN>(
)</SPAN><BR>{<BR>if ( FileNamesItr != FileNamesEnd
)<BR>{<BR>FileNamesItr++;<BR>ListPosition++;<BR>m_ImageReader->SetFileName(
FileNamesItr->c_str()
);<BR>m_ImageReader->Update();<BR>m_InputImage=m_ImageReader->GetOutput();<BR>}<BR><BR>//this->ShowInputImage();<BR><BR>InputImageType::RegionType
region
<BR> =
m_ImageReader->GetOutput()->GetLargestPossibleRegion();<BR><BR>
InputImageType::SizeType size = region.GetSize();<BR><BR>
for(unsigned int i=0; i<ImageDimension; i++)<BR>
{<BR> if( size[i] < 10
)<BR> {<BR>
this->ShowStatus("Image must be 3D and with at least 10 pixels along
each Dimension.");<BR> itk::ExceptionObject
excp;<BR> excp.SetDescription("Image must be
3D and with at least 10 pixels along each
Dimension.");<BR> throw
excp;<BR> }<BR>
}<BR><BR><BR> m_SeedImage->SetRegions( region );<BR !="">
m_SeedImage->Allocate();<BR> m_SeedImage->FillBuffer(
itk::NumericTraits<SeedImageType::PixelType>::Zero );<BR><BR>
m_FastMarchingFilter->SetOutputSize( region.GetSize()
);<BR>}<BR><BR><SPAN
style="FONT-STYLE: italic; TEXT-DECORATION: underline">//function for
reading the previous file in serie</SPAN><BR><SPAN
style="FONT-WEIGHT: bold">void</SPAN><BR style="FONT-WEIGHT: bold"><SPAN
style="FONT-WEIGHT: bold">ShapeDetectionLevelSetBase </SPAN><BR><SPAN
style="FONT-WEIGHT: bold">::<SPAN
style="TEXT-DECORATION: underline">LoadPrevImage</SPAN>(
)</SPAN><BR>{<BR><BR>if ( FileNamesItr != FileNamesBegin
)<BR>{<BR>FileNamesItr--;<BR>ListPosition--;<BR>m_ImageReader->SetFileName(
FileNamesItr->c_str()
);<BR>m_ImageReader->Update();<BR>mm_IInputImage=m_ImageReader->GetOutput();<BR>}<BR><BR>//this->ShowInputImage();<BR><BR>InputImageType::RegionType
region
<BR> =
m_ImageReader->GetOutput()->GetLargestPossibleRegion();<BR><BR>
InputImageType::SizeType size = region.GetSize();<BR><BR>
for(unsigned int i=0; i<ImageDimension; i++)<BR>
{<BR> if( size[i] < 10
)<BR> {<BR>
this->ShowStatus("Image must be 3D and with at least 10 pixels along
each Dimension.");<BR> itk::ExceptionObject
excp;<BR> excp.SetDescription("Image must be
3D and with at least 10 pixels along each
Dimension.");<BR> throw
excp;<BR> }<BR>
}<BR><BR><BR> m_SeedImage->SetRegions( region );<BR>
m_SeedImage->Allocate();<BR> m_SeedImage->FillBuffer(
itk::NumericTraits<SeedImageType::PixelType>::Zero );<!-- br-->
<BR> m_FastMarchingFilter->SetOutputSize( region.GetSize()
);<BR><BR>}<BR>/*********************************************************************************************/<BR><BR><BR>any
comment is welcome<BR>thx<BR>Amir,<BR>
<DIV></DIV>
<HR SIZE=1>
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
tarifs exceptionnels pour appeler la France et l'international. <A
href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com">Téléchargez</A>
la version beta.</BLOCKQUOTE></BLOCKQUOTE><BR>
<P>
<HR SIZE=1>
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs
exceptionnels pour appeler la France et l'international. <A
href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com">Téléchargez</A>
la version beta.</BLOCKQUOTE></BODY></HTML>