[vtkusers] RE : vtkmarchingcube

medo abdelmonem abdelmonem76 at yahoo.com
Mon Apr 9 09:06:13 EDT 2007


Hi Miladi,
  sorry for being late to reply....well...about the method "SetValue"....it's the method that defines the scalar according to which the contouring will occur....i.e if u have an image....all the points in the image that have the same scalar will be contoured....same thing for volumes (isosurfaces will be produced).....
  about the arguments of this method it takes two arguemnts...1st...index of contour (as contouring filters can take more than one input...u can use "0" if ther'll be filter object for each value).....2nd....contouring scalar value (e.g bones have 1150 value in ct dicom images...and this value really depends on ur scalar range)......
  regarding that u wanna create more than one isosurface...easily do it using different contouring values...then take the polydata output of ur one(or more) iso-surfaces....
  hope i understood what u really wanted....the book will represent a great aid for u if u wanna know more (see contouring Ch6 and last section of same chapter called putting all together)..
  best regards
Mohamed
  medamine <miladimedamine at yahoo.fr> wrote:
  Hi;
I m using vtkmarchingcube to do the 3D isosurface reconstruction from a
series slices segmented images.
but some methode as setvalue is not clear to me.
i would like to give you my code bellow and i want that let me your
comments because i have some problem in excuting him.
Olso i need to knew how to get multi surface and what the way to separate
them.
thanks.
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// marchingcube.cpp : Defines the entry point for the console application.
//
  #include "stdafx.h"
#include "vtkActor.h"
#include "vtkCamera.h"
#include "vtkCellArray.h"
#include "vtkFloatArray.h"
#include "vtkPointData.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkProperty.h" 
#include 
#include 
#include 
#include "vtkCell.h"
#include "vtkPLYReader.h"
#include 
#include 
#include 
#include 
#include 
  int main(int argc, char** argv)
{
  
//first convert series slices of image into volume data
  vtkVolume16Reader *m_reader=vtkVolume16Reader::New();
m_reader->SetDataDimensions(64,64);
m_reader->SetImageRange(1,93);
m_reader->SetDataByteOrderToLittleEndian();
m_reader->SetFilePrefix("C:\\test\\EffortEndocarde");//exemple of file
"C:\\test\\EffortEndocarde10"
m_reader->SetDataSpacing (3.2, 3.2, 1.5);
m_reader->Update();
  //second execute the vtkmarching cube
  vtkMarchingCubes *m_cube=vtkMarchingCubes::New();
vtkPolyData *m_polydata=vtkPolyData::New();//define an object frm the
filter
m_cube->SetValue(0,500); // set value corresponding to which the
isosurface will be created
m_cube->ComputeNormalsOff(); // turn Normals Creation off (u can do it
later...and only if u have light settings)
m_cube->ComputeGradientsOff(); // gradients off
m_cube->SetInput(m_reader->GetOutput()); // set input for the volume
from which u'll extract iso surface
m_polydata= m_cube->GetOutput(); // get o/p (it's of polydata type)
m_polydata->Update();
  vtkPolyDataMapper *m_polydataMapper = vtkPolyDataMapper::New();
m_polydataMapper->SetInput(m_polydata);
m_polydataMapper->SetScalarRange(0,7);
m_polydataMapper->Update();
  vtkActor *m_Actor = vtkActor::New();
m_Actor->SetMapper(m_polydataMapper);
  vtkRenderer *m_renderer = vtkRenderer::New();
vtkRenderWindow *m_renWin = vtkRenderWindow::New();
m_renWin->AddRenderer(m_renderer);
  vtkRenderWindowInteractor *m_iren = vtkRenderWindowInteractor::New();
m_iren->SetRenderWindow(m_renWin);
  vtkInteractorStyleTrackballCamera *m_style =
vtkInteractorStyleTrackballCamera::New();
m_iren->SetInteractorStyle(m_style);
  m_renderer->AddActor(m_Actor);
m_renderer->SetBackground(0.1, 0.2, 0.4);
  m_renWin->SetSize(300,300);
m_renWin->Render();
m_iren->Start();
  m_cube->Delete();
m_polydata->Delete();
m_polydataMapper->Delete();
m_Actor->Delete();
m_renderer->Delete();
m_renWin->Delete();
m_iren->Delete();
  return 0;
}
  -- 
View this message in context: http://www.nabble.com/vtkmarchingcube-tf3544529.html#a9894928
Sent from the VTK - Users mailing list archive at Nabble.com.
  _______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
   

 
---------------------------------
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070409/c23049e7/attachment.htm>


More information about the vtkusers mailing list