[vtkusers] how to arrange memory in multi-iso reconstruction by using vtkDiscreteMarchingCubes

Cory Quammen cquammen at cs.unc.edu
Tue Apr 20 08:55:30 EDT 2010


Wenwu,

If your goal is simply to visualize the isosurface, consider using a
vtkVolumeRayCastMapper with a vtkVolumeRayCastIsosurfaceFunction. See
http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/VolumeRendering/Testing/Cxx/volProt.cxx?root=VTK&content-type=text/plain
for an example of how to use these classes. This will not use nearly
as much memory as extracting isosurface geometry.

Cory

On Tue, Apr 20, 2010 at 2:35 AM, 朱文武 <cool.wenwu at gmail.com> wrote:
> Dear bill and all,
>
> I have sent this message last night ! However, no one responded! So i sent
> it again. I hope vtk users can forgive me if it disturbed you!
> The problem of mine is that when i use vtkDiscreteMarchingCubes to extract
> multi-iso surfaces , the number of scalar value sometimes is more than ten
> and vtk will report error. The error message likes that:
> Error:in c:\vtk5.0\vtk\common\vtkDataArrayTemplate.cxx line 255
> vtkIdTypeArray(0x...):unable to allocate 62300005 elements of size 2
>
> The type of dataset is "bmp" : 300*349*500.  The developing tools are VC6.0
> + vtk5.1
>
> I remember bill ever sent important information of reducing memory usage to
> me, such as call ReleaseDataFlagOn(). However, the memory problem is still
> existed.  I believe this problem existed commonly in the 3D reconstruction.
> Could any one provide efficient solutions? Thanks in advance !
>
> Here are the all related codes:
>
> vtkSmartPointer<vtkBMPReader> m_read = vtkSmartPointer<vtkBMPReader>::New();
> ...
>
> vtkSmartPointer<vtkDiscreteMarchingCubes> cube =
>     vtkSmartPointer<vtkDiscreteMarchingCubes>::New() ;
> cube->SetInput((vtkDataObject*) m_read->GetOutput() );
> cube->SetValue(0, 111);
> cube->SetValue(1, 121);
> ...
> cube->ReleaseDataFlagOn();
> cube->ComputeNormalOff();
>
> vtkSmartPointer<vtkWindowedSincPolyDataFilter> smoother=
> vtkSmartPointer<vtkWindowedSincPolyDataFilter>::New();
> smoother->SetInput(deci->GetOutput());
> smoother->SetNumberOfIterations(30) ;
> smoother->NonManifoldSmoothingOn();
> smoother->NormalizeCoordinatesOn();
> smoother->GenerateErrorScalarsOn() ;
> smoother->ReleaseDataFlagOn();
>
> vtkSmartPointer<vtkPolyDataNormals> triangleCellNormals =
> vtkSmartPointer<vtkPolyDataNormals>::New();
> triangleCellNormals->SetInput(smoother->GetOutput());
> triangleCellNormals->ComputeCellNormalsOn();
> triangleCellNormals->ComputePointNormalsOff();
> triangleCellNormals->ConsistencyOn();
> triangleCellNormals->AutoOrientNormalsOn();
> triangleCellNormals->ReleaseDataFlagOn();
>
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper->SetInput(triangleCellNormals->GetOutput()); // #this is better for
> vis
> mapper->ScalarVisibilityOn() ;//#show colour
> mapper->SetScalarRange(colorLookupTable->GetTableRange());
> mapper->SetScalarModeToUseCellData() ; //  contains the label eg. 31
> mapper->SetLookupTable(colorLookupTable);
> mapper->ReleaseDataFlagOn();
>
>
> thanks,
> Wenwu
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



-- 
Cory Quammen
Center for Computer Integrated Systems for Microscopy and Manipulation (CISMM)
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen



More information about the vtkusers mailing list