[vtkusers] vtk memory issue, support needed

Raúl Ferriz raul at torresyvalero.com
Fri Jul 30 02:52:25 EDT 2010


El 29/07/2010 17:29, David Gobbi escribió:
> You are correct.  When viewing only axial slices of an axial dataset,
> VTK should stream the images slice-by-slice. It's important that you
> never call Update() on an image in your own code with setting the
> UpdateExtent first, since Update() will update the WholeExtent by
> default in the UpdateExtent is not set.
>
> Regarding the viewer, I looked through vtkImageViewer2.cxx and saw
> this code at line 478:
>
>        if (event == vtkCommand::ResetWindowLevelEvent)
>          {
>          this->IV->GetInput()->UpdateInformation();
>          this->IV->GetInput()->SetUpdateExtent
>            (this->IV->GetInput()->GetWholeExtent());
>          this->IV->GetInput()->Update();
>          double *range = this->IV->GetInput()->GetScalarRange();
>          this->IV->SetColorWindow(range[1] - range[0]);
>          this->IV->SetColorLevel(0.5 * (range[1] + range[0]));
>          this->IV->Render();
>          return;
>          }
>
> I suspect that this code is the problem.  This is one of the reasons
> that I never use vtkImageViewer and always use a raw vtkImageActor
> instead.  The ImageViewer has a lot of "convenience" features that
> people have added to make their lives easier, and these convenience
> features often have unexpected side effects.
>
>    David
>
>    

Thanks for pointing to this!

I have duplicated vtkImageViewer2 classes as vtkImageViewer3 and removed 
this lines, really I have commented out lines on 
vtkImageViewer3::InstallPipeline(), the lines that installs callbacks 
for WindowLevel :

     if (!this->InteractorStyle)
       {
       this->InteractorStyle = vtkInteractorStyleImage::New();
       //vtkImageViewer_ebuCallback *cbk = vtkImageViewer_ebuCallback::New();
       //cbk->IV = this;
       //this->InteractorStyle->AddObserver(
       //  vtkCommand::WindowLevelEvent, cbk);
       //this->InteractorStyle->AddObserver(
       //  vtkCommand::StartWindowLevelEvent, cbk);
       //this->InteractorStyle->AddObserver(
       //  vtkCommand::ResetWindowLevelEvent, cbk);
       //cbk->Delete();
       }


so now on my code never an Update or UpdateWholeExtent is called 
anymore. But when my program reach last line on vtkImageViewer3::Render():

	if (this->RenderWindow)
	{
		this->RenderWindow->Render();  //<-- Here the whole dicom is loaded
	}

Throws exception of not enought memory. I have even forced to set Slice 
= 1, to ensure a call to UpdateDisplayExtent().
Should I report this as a bug on vtkGDCMImageReader ?

Many thanks.



More information about the vtkusers mailing list