[vtkusers] Use marching cubes on MINC data

David Gobbi david.gobbi at gmail.com
Mon Mar 12 14:11:48 EDT 2012


Remove the vtkVoxelModeller.  As Bill says, you should pass the data
directly from the reader to marching cubes.

 - David


On Mon, Mar 12, 2012 at 11:55 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> Does the mind data have continuous grayscale values or are the values
> discrete (from a segmentation algorithm)?
>
> If they are continuous, pass the data directly to marching cubes (no
> voxelmodeller). You will need to select a proper isosurface value for
> the structure you want to see.
>
> If the data is discrete, use DiscreteMarchingCubes and pass in the
> value for the segmented structure you want so see.
>
> On Mon, Mar 12, 2012 at 10:28 AM, Tanweer Rashid <trash001 at odu.edu> wrote:
>> Hi all,
>>
>> I am trying to extract surfaces from a MINC (.mnc) data file using
>> vtkMarchingCubes. The code I am using is based on the VTK wiki's Marching
>> cubes on a sphere example, and is as follows:
>>
>> void marching_cubes() {
>>     vtkMINCImageReader* minc = vtkMINCImageReader::New();
>>     minc->SetFileName("/home/trash001/Desktop/AtlasGrey.mnc");
>>
>>     vtkVoxelModeller* voxelModeller = vtkVoxelModeller::New();
>>
>>     voxelModeller->SetSampleDimensions(197, 233, 189);
>>     voxelModeller->SetModelBounds(-98, 99, -134, 99, -72, 117);
>>     voxelModeller->SetScalarTypeToFloat();
>>     voxelModeller->SetMaximumDistance(.01);
>>     voxelModeller->SetInputConnection(minc->GetOutputPort());
>>
>>     vtkMarchingCubes* surface = vtkMarchingCubes::New();
>>     surface->SetInputConnection(voxelModeller->GetOutputPort());
>>     surface->ComputeNormalsOn();
>>     surface->SetValue(0, 0.5);
>>
>>     vtkRenderer* renderer = vtkRenderer::New();
>>     renderer->SetBackground(.1, .2, .3);
>>
>>     vtkRenderWindow* renderWindow = vtkRenderWindow::New();
>>     renderWindow->AddRenderer(renderer);
>>     vtkRenderWindowInteractor* interactor =
>> vtkRenderWindowInteractor::New();
>>     interactor->SetRenderWindow(renderWindow);
>>
>>     vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
>>     mapper->SetInputConnection(surface->GetOutputPort());
>>
>>     vtkActor* actor = vtkActor::New();
>>     actor->SetMapper(mapper);
>>
>>     renderer->AddActor(actor);
>>
>>     renderWindow->Render();
>>     interactor->Start();
>>     return;
>> }
>>
>> When I run this code, I get a blank window. I suspect that the problem is
>> that I cannot provide the MINC data to vtkMarchingCubes in a suitable
>> format, but I could be wrong. Any help would be appreciated.
>>
>> Thanks,
>> --
>> Tanweer Rashid
>> Graduate Teaching & Research Assistant
>> Department of Modeling, Simulation and Visualization Engineering
>> Old Dominion University
>>
>>
>> _______________________________________________
>> 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



More information about the vtkusers mailing list