[vtkusers] vtkImageDataGeometryFilter problem
Kim Rosenbohm
kim.rosenbohm at posteo.de
Wed Aug 6 12:25:35 EDT 2014
Answering my own question here:
Apparently "ThresholdValueOn()" resolves to a Macro that takes a bool
and sets the threshold value to the value "true" aka 1.
Really misleading. Is this a bug or Feature?! The documentation lacks
there. At least tell me != 0 is on (besides that I might like to use 0
as an actual threshold...)
Please forgive my rant, but I notice the problem throughout VTK with
the C++ interface:
* Just take a look a "vtkCubeAxesActor". Theres such a load of
functions that are basically "Set"/"On"/"Off":
"SetXAxisVisibility(int)" <- Why an int?!
"XAxisVisibilityOn()/Off()" <- You've now tripled the functions...
Why not instead a simple "SetXAxisVisibility(bool)"?! ...as in turn
there actually IS only one "Get"-function...
* There's functions that take an int as a parameter, but actually
expect an enum, e.g. "vtkCubeAxisActor::SetTickLocation(int)"
There's no proper way of telling which are the expected input values.
Why not use an actual enum?!
* vtkImageData has "SetDimensions" marked as deprecated, but
"SetExtent" uses width-1, height-1, plane-1...
This is IMAGE data. If you actually USE it for images you now always
have to do a +1 or -1...
Just my 50ct about the library. My first 2-3 weeks have been pretty
frustrating...
Best Regards,
Kim
Am 05.08.2014 14:28 schrieb Kim Rosenbohm:
> Hi All.
>
> Though nobody responded to my previous question, I'll try again with a
> different problem:
> I have a pipeline for masking out areas in a 2D image and turning the
> image data into a 3D surface:
>
> ...
> vtkSmartPointer< vtkImageResample > m_surfaceResampled;
> vtkSmartPointer< vtkImageResample > m_maskResampled;
> vtkSmartPointer< vtkImageMask > m_maskMask;
> vtkSmartPointer< vtkImageDataGeometryFilter > m_surfaceGeoFilter;
> vtkSmartPointer< vtkWarpScalar > m_surfaceWarpFilter;
>
> //use a vtkImageMask to remove masked-out stuff from an image
> m_maskMask->SetInputConnection(0,
> m_surfaceResampled->GetOutputPort());
> m_maskMask->SetInputConnection(1, m_maskResampled->GetOutputPort());
> m_maskMask->SetMaskedOutputValue(-10000);
> //m_maskMask->SetMaskAlpha(0.0);
> //setup filter creating geometry from image/height data
> m_surfaceGeoFilter->SetInputConnection(m_maskMask->GetOutputPort());
> //setup masking out of cells marked in mask
> m_surfaceGeoFilter->ThresholdCellsOn();
>
m_surfaceGeoFilter->SetThresholdValue(*m_maskMask->GetMaskedOutputValue());
> m_surfaceGeoFilter->ThresholdValueOn();
> //pass geometry to scale surface z-axis height
>
m_surfaceWarpFilter->SetInputConnection(m_surfaceGeoFilter->GetOutputPort());
> m_surfaceWarpFilter->SetScaleFactor(1.0);
> ...
>
> This works ok for positive values in m_surfaceResampled, but not if I
> only have negative values there.
> Then I get no surface at all... Why?
> Additionally an eleborate explanation of what ThresholdCELLS and
> ThresholdVALUE do
> and how they interact would be nice. The documentation is not
> dummy-proof
> enough for me there...
>
> Best Regards,
>
> Kim
>
> _______________________________________________
> Powered by www.kitware.com [1]
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html [2]
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ [3]
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers [4]
--
Kim Rosenbohm, Barfüßerstr. 7, 37073 Göttingen, 0163/8723172
Links:
------
[1] http://www.kitware.com
[2] http://www.kitware.com/opensource/opensource.html
[3] http://www.vtk.org/Wiki/VTK_FAQ
[4] http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list