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.cxx<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="text-decoration: underline; font-style: italic;">//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="text-decoration: underline; font-style: italic;">//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="text-decoration: underline; font-style: italic;">//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_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> /********************************************************************************************/<br> <br> <br> any comment is welcome<br> thx<br> Amir,<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.