[vtkusers] The confusion of vtkMarchingCubes

朱文武 cool.wenwu at gmail.com
Wed Apr 14 09:31:16 EDT 2010


Karthik Krishnan, thanks for your great help!
However, firstly, i still can not understand the mean of the parameter-value
in the member function-SetValue(int i, double value) of vtkMarchingCubes.
For example, if the value is set to 110 (The  type of dataset is bmp ),  which
isosurfaces should be extracted? The structure whose gray value is 110 or
all structures whose gray value is below 110 ? Could you tell me?!
Secondly,  could you provide some examples for the vtkDiscreteMarchingCubes
, though i read the help in the "vtk documentation",  there is no detailed
example illustrating it.  I also do not know  how to color the result !
>From my perspective, we can control the color through vtkActor,  there are
other methods to control the properties of parts of the actor?

Thanks.

Wenwu



On Wed, Apr 14, 2010 at 5:17 PM, Karthik Krishnan <
karthik.krishnan at kitware.com> wrote:

> You could use vtkDiscreteMarchingCubes and color the result by cell data
>
> or
>
> pre-process your data to set all the non-foreground voxels to background,
> (so as to make it bilelvel) and then run marching cubes to extract each
> label.
>
> On Wed, Apr 14, 2010 at 4:44 AM, 朱文武 <cool.wenwu at gmail.com> wrote:
>
>> hi all,
>>
>>       A problem confused me. I need your help. The class vtkMarchingCubes
>> has been adapted to construct a specified structure ( extract specified
>> isosurface),  the member function— vtkMarchingCubes::setvalue(int i, double
>> value) is used to specify a particular contour value.  The type of dataset i
>> used was gray bmp image.  Suppose the dataset contains gray value: 91, 111,
>> 121, 137.
>> Now the problem is that if i want to construct the anatomy structure whose
>> gray value is 111,  so the code i write is that
>> SetValue(0, 111).  However,  the result of construction is that almost all
>> anatomy structures whose gray value is 91, 121, 137 have been constructed
>> too. Why is it happens? what's the difference between the gray value in the
>> bmp image and the contour value in this function?  And how to construct a
>> specified structure?
>>
>> If we set the parameter -value to 111,  according to the MC algorithm,
>> the specified isosurface should be extracted.  Do i understand wrong !?
>> On the other hand, if i want to extract multiple isosurface and control
>> property of each isosurface such as colors, how to do it? The function
>> SetValue(int i, double value) can not accomplish the task. Though we can add
>> contour value by increasing the index-i, the output of the vtkMarchingCubes
>> is combined to the subsequent filter. Can anyone provide help? Thanks very
>> much !
>>
>> The relevant code and original image and result of the construction is
>> attached:
>>
>> Code:
>>     vtkBMPReader *Image= vtkBMPReader::New();
>>     // read the dataset
>>      Image->Update();
>>
>>     vtkMarchingCubes *skinExtractor= vtkMarchingCubes::New();//
>> skinGray=220,tendon=10,radius=20,ulna=40,
>>     skinExtractor->SetInputConnection(Image->GetOutputPort());
>>     skinExtractor->SetValue(0,111);// input the gray value
>>     skinExtractor->ComputeGradientsOn();
>>     skinExtractor->ComputeScalarsOff();
>>
>>     vtkDecimatePro *vdeci;
>>     vdeci->SetInputConnection(skinExtractor->GetOutputPort());//
>>     vdeci->SetTargetReduction(0.6);//
>>     vdeci->PreserveTopologyOn();//
>>
>>     vtkSmoothPolyDataFilter *vsmoother;
>>     vsmoother->SetInputConnection(vdeci->GetOutputPort());//
>>     vsmoother->SetNumberOfIterations(800);//
>>
>>     vtkPolyDataNormals *vskinNormal;
>>     vskinNormal->SetInputConnection(vsmoother->GetOutputPort());//
>>     vskinNormal->SetFeatureAngle(60.0);//
>>
>>     vtkPolyDataMapper *vskinMapper;
>>     vskinMapper->SetInputConnection(vskinNormal->GetOutputPort());
>>     vskinMapper->ScalarVisibilityOff();//
>>
>>     vtkActor *vskin;
>>     vskin->SetMapper(vskinMapper);//
>>     vskin->GetProperty()->SetColor(1,0,0);
>>
>> The original image :
>> [image: TCVH_1300副本.bmp]
>>
>> _______________________________________________
>> 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
>>
>>
>
>
>
>


-- 
祝
工作愉快,身体健康!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100414/0cbd969a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/bmp
Size: 47680 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100414/0cbd969a/attachment.bin>


More information about the vtkusers mailing list