[vtkusers] Exception problems

ivan gm ivan.gm.itk at gmail.com
Mon May 5 04:57:59 EDT 2008


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<http://mycareer.com.au/?s_cid=596064>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080505/5b62b1b3/attachment.htm>


More information about the vtkusers mailing list