Hi Jim,<br> thx very much<br> i just add a call to the<span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2"> </font></span><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2">UpdateLargestPossibleRegion() <span style="color: rgb(0, 0, 0);">method , and every thing was ok</span>:</font></span><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2"><br> &nbsp; .<br> &nbsp; .<br> </font></span>&nbsp; m_ImageReader-&gt;SetFileName( FileNamesItr-&gt;c_str());<br> &nbsp; m_ImageReader-&gt;Update();<br> <span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2">&nbsp; m_ImageReader-&gt;UpdateLargestPossibleRegion()<br> &nbsp; .<br> &nbsp; .<br> &nbsp; <span style="color: rgb(0, 0, 0);">Regards, <br> &nbsp; Amir.<br> </span></font></span><br><b><i>"Miller, James V (GE, Research)" &lt;millerjv@crd.ge.com&gt;</i></b> a écrit&nbsp;:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255);
 margin-left: 5px; padding-left: 5px;">   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">   <meta content="MSHTML 6.00.2900.2802" name="GENERATOR"> <div><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2">The  problem is probably in your LoadNextImage() method.&nbsp; </font></span></div> <div><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2"></font></span>&nbsp;</div> <div><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2">What  ImageType is ImageFileReader loading?&nbsp; Is it a 2D or 3D  image?</font></span></div> <div><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2"></font></span>&nbsp;</div> <div><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2">When a  pipeline is run the first time, it establishes a set of region requests at each  stage in the pipeline.&nbsp; The last filter places a request on the filter  before it, that
 filter places a request on the filter before it, ...&nbsp; When  you changed the filename on the reader, the reader may no longer satisfy the  request cached between it and the downstream filters.&nbsp; 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 color="#0000ff" face="Arial" size="2"></font></span>&nbsp;</div> <div><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2"></font></span>&nbsp;</div> <div><span class="906544221-01022006"><font color="#0000ff" face="Arial" size="2">Jim</font></span></div> <blockquote>   <div class="OutlookMessageHeader" align="left" dir="ltr"><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&nbsp;    <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>&nbsp;
 {<br>&nbsp;&nbsp;&nbsp;    return;<br>&nbsp; }<br>&nbsp;nameGenerator-&gt;SetDirectory( dirname    );<br>&nbsp;seriesUID =    nameGenerator-&gt;GetSeriesUIDs();<br>&nbsp;<br>&nbsp;seriesIdentifier =    seriesUID.begin()-&gt;c_str();<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;    <br>&nbsp;&nbsp;&nbsp; fileNames = nameGenerator-&gt;GetFileNames(    seriesIdentifier );<!--  br--> &nbsp;&nbsp;&nbsp; FileNamesBegin =    fileNames.begin();<br>&nbsp;&nbsp;&nbsp; FileNamesItr =    fileNames.end();<br>&nbsp;&nbsp;&nbsp; FileNamesEnd =    fileNames.end();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;    ListCardinal=0;<br>&nbsp;&nbsp;&nbsp; ListPosition=1;<br>&nbsp;&nbsp;&nbsp;    while( FileNamesItr != FileNamesBegin )<br>&nbsp;&nbsp;&nbsp;    {<br>&nbsp;&nbsp;&nbsp;&nbsp; ListCardinal++;<br>&nbsp;&nbsp;&nbsp;&nbsp;    FileNamesItr--;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;<br>&nbsp;    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>&nbsp;<br>&nbsp; m_ImageReader-&gt;SetFileName(    FileNamesItr-&gt;c_str());<br>&nbsp; m_ImageReader-&gt;Update();<br>&nbsp;    m_InputImage=m_ImageReader-&gt;GetOutput();<br><br>&nbsp; // Allocate an image    of seeds of the same size<br>&nbsp; InputImageType::RegionType region    <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =    m_ImageReader-&gt;GetOutput()-&gt;GetLargestPossibleRegion();<br><br>&nbsp;    InputImageType::SizeType size = region.GetSize();<br><br>&nbsp; for(unsigned    int i=0; i&lt;ImageDimension; i++)<br>&nbsp;&nbsp;&nbsp;    {<br>&nbsp;&nbsp;&nbsp; if( size[i] &lt; 10   
 )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    this-&gt;ShowStatus("Image must be 3D and with at least 10 pixels along each    Dimension.");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; itk::ExceptionObject    excp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; excp.SetDescription("Image must be 3D    and with at least 10 pixels along each    Dimension.");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw !    excp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;    }<br><br><br>&nbsp; m_SeedImage-&gt;SetRegions( region );<br>&nbsp;    m_SeedImage-&gt;Allocate();<br>&nbsp; m_SeedImage-&gt;FillBuffer(    itk::NumericTraits&lt;SeedImageType::PixelType&gt;::Zero );<br><br>&nbsp;    m_FastMarchingFilter-&gt;SetOutputSize( region.GetSize() );<br><br><br>&nbsp;    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-&gt;SetFileName(    FileNamesItr-&gt;c_str()    );<br>m_ImageReader-&gt;Update();<br>m_InputImage=m_ImageReader-&gt;GetOutput();<br>}<br><br>//this-&gt;ShowInputImage();<br><br>InputImageType::RegionType    region <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    = m_ImageReader-&gt;GetOutput()-&gt;GetLargestPossibleRegion();<br><br>&nbsp;    InputImageType::SizeType size = region.GetSize();<br><br>&nbsp; for(unsigned    int i=0; i&lt;ImageDimension; i++)<br>&nbsp;&nbsp;&nbsp;    {<br>&nbsp;&nbsp;&nbsp; if( size[i] &lt; 10    )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
 this-&gt;ShowStatus("Image must be 3D and with at least 10 pixels along each    Dimension.");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; itk::ExceptionObject    excp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; excp.SetDescription("Image must be 3D    and with at least 10 pixels along each    Dimension.");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw    excp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;    }<br><br><br>&nbsp; m_SeedImage-&gt;SetRegions( region );<br !=""> &nbsp;    m_SeedImage-&gt;Allocate();<br>&nbsp; m_SeedImage-&gt;FillBuffer(    itk::NumericTraits&lt;SeedImageType::PixelType&gt;::Zero );<br><br>&nbsp;    m_FastMarchingFilter-&gt;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 style="font-weight: bold;"><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-&gt;SetFileName(    FileNamesItr-&gt;c_str()    );<br>m_ImageReader-&gt;Update();<br>m_IInputImage=m_ImageReader-&gt;GetOutput();<br>}<br><br>//this-&gt;ShowInputImage();<br><br>InputImageType::RegionType    region <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    = m_ImageReader-&gt;GetOutput()-&gt;GetLargestPossibleRegion();<br><br>&nbsp;    InputImageType::SizeType size = region.GetSize();<br><br>&nbsp; for(unsigned    int i=0; i&lt;ImageDimension; i++)<br>&nbsp;&nbsp;&nbsp;    {<br>&nbsp;&nbsp;&nbsp; if( size[i] &lt; 10    )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    this-&gt;ShowStatus("Image must be 3D and with at least 10 pixels along each    Dimension.");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 itk::ExceptionObject    excp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; excp.SetDescription("Image must be 3D    and with at least 10 pixels along each    Dimension.");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw    excp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;    }<br><br><br>&nbsp; m_SeedImage-&gt;SetRegions( region );<br>&nbsp;    m_SeedImage-&gt;Allocate();<br>&nbsp; m_SeedImage-&gt;FillBuffer(    itk::NumericTraits&lt;SeedImageType::PixelType&gt;::Zero );<!--  br--> <br>&nbsp; m_FastMarchingFilter-&gt;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.