[vtkusers] Exception problems

Cameron Burnett w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
Mon May 5 08:00:21 EDT 2008


I'm working with 2GB at the moment. If I call SetReleaseDataFlag(true) on every filter in my pipeline, then I can work with DICOM datasets up to about 400MB. More RAM would surely help (provided that you're not using a single core processor), but there are ways around it like the ones I told you about in the email. And there are certain benefits/drawbacks for either approach..... like if you don't release your data it will chew up your memory but will be quite fast.... and if you do release then it will use less memory but will be slower (from my experience it has been slower).

As for the try/catch thing.... did you try putting that around every update function?? If you go through and do each one separately then you should eventually find the one that is the problem.



Date: Mon, 5 May 2008 10:57:59 +0200
From: ivan.gm.itk at gmail.com
To: vtkusers at vtk.org
Subject: [vtkusers] Exception problems


Hello Cameron:
 
First of all thanks a lot for your reply. If I improve the RAM and the Graphic card Memory... Do you think my problem could be solved? I'm using 2 GB of RAM and 256 MB of Graphics Memory now.
NOTE: The try catch didn't catch the last message exception mentioned.


 
On Mon, Apr 28, 2008 at 12:57 PM, Cameron Burnett <w_e_b_m_a_s_t_e_r_6_9 at hotmail.com> wrote:



The problem is probably due to a lack of memory. You can catch these problems by putting a try/catch around your Update() functions, and you should get an error message. This is the code you can use for MFC.



  try
    {
          filter->Update();
    }
  catch( itk::ExceptionObject & excep )
    {
        CString msg;
        msg.Format("Error: %s", excep.GetDescription());
        AfxMessageBox(msg, MB_ICONERROR);


    }


If you want to fix this you can do a few things. One thing you can do is call the SetReleaseDataFlag(true) function on everything in your pipeline. This will release memory once it's no longer in use, however it will slow down your program considerably.



Some filters also support streaming. This breaks a task down into smaller pieces and you end up not needing to allocate a lot of memory all at once. You can set it up like this, and you just simply connect it to your pipeline and call Update() on it in order to stream through the pipeline.



  typedef itk::StreamingImageFilter< OutputImageType,OutputImageType > StreamingFilterType;
  StreamingFilterType::Pointer streamer = StreamingFilterType::New();
  streamer->SetReleaseDataFlag(true);



  streamer->SetNumberOfStreamDivisions(4);


Have a look at your operating system's memory usage while you run the program. And if you include the try/catch thing you should be able to figure out where your program gets up to before it runs out of memory. Note that the program will continue to run after that point, and that is why it seems like it works until the end.




Hope this helps,

Cameron.








Date: Mon, 28 Apr 2008 11:08:41 +0200
From: ivan.gm.itk at gmail.com
To: vtkusers at vtk.org
Subject: [vtkusers] Exception problems 




Hello:

I have a problem with a not controled exception in runtime. I'm using windows, MFC, VTK, ITK in Visual Studio 2005. My code looks like this:

....
pitkDICOMReader->SetFileNames(files);


pitkDICOMReader->SetImageIO( itk::GDCMImageIO::New() );
pitkDICOMReader->Update();
filter = ThresholdType::New();
filter->SetInput( this->pitkDICOMReader);
filter->ThresholdOutside(minT, maxT);


filter->Update();
...
( typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType; )
connector->SetInput( filter->GetOutput() );
connector->Update();

/*now I create a 3D polydata*/


contourFilter->SetInput(connector->GetOutput());
contourFilter->Update();
smoothFilter->SetInputConnection(contourFilter->GetOutputPort());
smoothFilter->SetNumberOfIterations(30);
smoothFilter->SetRelaxationFactor(1.0);


smoothFilter->Update();
polyDataNormals->SetInputConnection(smoothFilter->GetOutputPort());
polyDataNormals->Update();
this->BoneMapper->SetInput(polyDataNormals->GetOutput());
this->BoneMapper->Update();


this->BoneActor->SetMapper(this->BoneMapper);
this->BoneActor->GetProperty()->SetColor(1.0, 1.0, 0.0);
this->BoneActor->GetProperty()->SetDiffuse(0.0);
this->BoneActor->GetProperty()->SetSpecular(1.0);


this->BoneActor->GetProperty()->SetSpecularPower(5);
this->pvtkRenderer3D->AddActor(this->BoneActor);
this->pvtkRenderer3D->ResetCamera();
if (this->pvtkMFCWindow3D)    this->pvtkMFCWindow3D->RedrawWindow();        //"the program crash here"



When I open 3D images with 100 slices it runs perfect but with one of the images (with 350 slices) the program crash in runtime and Visual Studio shows the following error message:

Excepción no controlada en 0x0d9e5c01 en myaplication.exe: 0xC0000005: Infracción de acceso al escribir en la ubicación 0x00000000.



After that the file ftime64.c apairs in Visual Studio at line 130 where it calls to _ftime64_s(tp);

In addition, when I comment the smoothfilter and other previous filters it works good.

What could the problem be? Do you know how I can solve it?




Thanks a lot.

Iván García Martínez.



before someone else does Find the job of your dreams




_________________________________________________________________
Never miss another e-mail with Hotmail on your mobile.
http://www.livelife.ninemsn.com.au/article.aspx?id=343869
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080505/636d9f74/attachment.htm>


More information about the vtkusers mailing list