[vtk-developers] Fwd: [vtkusers] coloring vtkDiscreteMarchingCubes

Bill Lorensen bill.lorensen at gmail.com
Fri Nov 11 10:43:18 EST 2011


Randy,

please note that the following comment from the discrete MC header;
// If ComputeScalars is on (the default), each output cell will have
// cell data that corresponds to the scalar value (segmentation label)
// of the corresponding cube. Note that this differs from vtkMarchingCubes,
// which stores the scalar value as point data. The rationale for this
// difference is that cell vertices may be shared between multiple
// cells. This also means that the resultant polydata may be
// non-manifold (cell faces may be coincident). To further process the
// polydata, users should either: 1) extract cells that have a common
// scalar value using vtkThreshold, or 2) process the data with
// filters that can handle non-manifold polydata
// (e.g. vtkWindowedSincPolyDataFilter).


On Fri, Nov 11, 2011 at 9:32 AM, Randy Heiland <heiland at indiana.edu> wrote:
> OK, when I get some time, I'll try a different reader.  But nevertheless, it doesn't explain why my super-simple script, with a super-simple dataset, doesn't work as expected :)
>
> -Randy
>
> On Nov 11, 2011, at 8:19 AM, Bill Lorensen wrote:
>
>> Randy,
>>
>> That example expects the data to be in meta format. You can try
>> replacing the reader with a vtkDataSetReader.
>>
>> Bill
>>
>> On Thu, Nov 10, 2011 at 7:22 PM, Randy Heiland <heiland at indiana.edu> wrote:
>>> Bill,
>>> Thanks for your reply.  The wiki link I provided contains my entire, small
>>> dataset, f_7x4x4_height.vtk, which does indeed consist of integral data
>>> (just 0s,1s,2s,3s).  And the DMC filter does generate the desired geometry.
>>>  It's just that when I then try to color it according to another (integral)
>>> field, it's as if the mapper disregards the color array.
>>> If there's something I can do to make this easier to test, e.g. provide a
>>> C++ example instead of Python, I can do that.
>>>
>>> I also tried to blindly use VTK's example DMC pgm on my simple dataset, but
>>> had errors (not surprisingly):
>>> $ /Users/heiland/dev/vtk-build/vtk-8-2-11/bin/GenerateModelsFromLabels
>>> ~/dev/vtk-stuff/f_7x4x4.vtk 0 3
>>> Incomplete file record definition
>>> NDims required and not defined.
>>> MetaObject: Read: MET_Read Failed
>>> MetaImage: M_Read: Error parsing file
>>> MetaImage: Read: Cannot parse file
>>> ERROR: In /Users/heiland/Documents/workspace/VTK/IO/vtkMetaImageReader.cxx,
>>> line 84
>>> vtkMetaImageReader (0x7f8f29002000): MetaImage cannot parse file.
>>> Incomplete file record definition
>>> NDims required and not defined.
>>> MetaObject: Read: MET_Read Failed
>>> MetaImage: M_Read: Error parsing file
>>> MetaImage: Read: Cannot parse file
>>> ERROR: In /Users/heiland/Documents/workspace/VTK/IO/vtkMetaImageReader.cxx,
>>> line 224
>>> vtkMetaImageReader (0x7f8f29002000): MetaImage cannot read data from file.
>>> ERROR: In
>>> /Users/heiland/Documents/workspace/VTK/Graphics/vtkDiscreteMarchingCubes.cxx,
>>> line 292
>>> vtkDiscreteMarchingCubes (0x7f8f28501bf0): Cannot contour data of dimension
>>> != 3
>>> ERROR: In
>>> /Users/heiland/Documents/workspace/VTK/Graphics/vtkWindowedSincPolyDataFilter.cxx,
>>> line 112
>>> vtkWindowedSincPolyDataFilter (0x7f8f285024f0): No data to smooth!
>>>
>>> thanks, Randy
>>>
>>>
>>> On Nov 10, 2011, at 6:02 PM, Bill Lorensen wrote:
>>>
>>> Randy,
>>>
>>> I have not looked at your data yet. But in general, MarchingCubes
>>> processes continuous data while DiscreteMarchingCubes processes
>>> integral data, typically created by a segmentation algorithm. T\he two
>>> algorithms are not normally used on the same datasets. What is the
>>> character of your data?
>>>
>>> Bill
>>>
>>> On Tue, Nov 8, 2011 at 7:05 AM, Randy Heiland <heiland at indiana.edu> wrote:
>>>
>>> Since I never got a response on the users list, I'll try the dev list.
>>>
>>> thanks, Randy
>>>
>>> Begin forwarded message:
>>>
>>> From: Randy Heiland <heiland at indiana.edu>
>>>
>>> Subject: [vtkusers] coloring vtkDiscreteMarchingCubes
>>>
>>> Date: November 3, 2011 11:43:12 AM EDT
>>>
>>> To: <vtkusers at vtk.org>
>>>
>>> Hi all,
>>>
>>> I'm puzzled by the following:  if I extract a surface from a 3D dataset
>>>
>>> using vtkContourFilter, I can color it according to a different scalar
>>>
>>> field; however, if I use vtkDiscreteMarchingCubes, my same pipeline doesn't
>>>
>>> color it.
>>>
>>> I've put a simple dataset and Python script here (near the bottom):
>>>
>>>  http://old.compucell3d.org/mediawiki1.7/index.php/Vtk_contours_3D
>>>
>>> and built VTK from git a couple months ago:
>>>
>>> In [3]: vtk.vtkVersion.GetVTKVersion()
>>>
>>> Out[3]: '5.9.0'
>>>
>>>
>>> thanks, Randy
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>>
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>>
>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>>
>>>
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>
>



-- 
Unpaid intern in BillsBasement at noware dot com



More information about the vtk-developers mailing list