<!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>&nbsp;</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>&nbsp;</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>&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 face=Arial color=#0000ff 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="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.&nbsp; 
    </FONT></SPAN></DIV>
    <DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff 
    size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff 
    size=2>What ImageType is ImageFileReader loading?&nbsp; Is it a 2D or 3D 
    image?</FONT></SPAN></DIV>
    <DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff 
    size=2></FONT></SPAN>&nbsp;</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.&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 face=Arial color=#0000ff 
    size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN class=906544221-01022006><FONT face=Arial color=#0000ff 
    size=2></FONT></SPAN>&nbsp;</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&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();<BBR>&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><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>mm_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.</BLOCKQUOTE></BODY></HTML>