[vtkusers] Image Blob as polydata.
Cory Quammen
cory.quammen at kitware.com
Mon Oct 26 09:16:29 EDT 2015
Hi Tariq,
It would be easier to diagnose with a full code listing that includes the
class instantiation so we know what classes you are using. As it is, I can
guess that you are using vtkImageThreshold instead of vtkThreshold.
vtkImageThreshold will not clip away the cells you don't want - you need to
use vtkThreshold to do that. vtkImageThreshold will produce a vtkImageData
output where the voxel values may change, but it won't clip away any data.
On a side note, I recommend that you do the following to set up your
pipeline:
vtkJPEGReader* jpgRead = vtkJPEGReader::New();
jpgRead->SetFileName(y.c_str());
vtkThresholdFilter* thresholder = vtkThresholdFilter::New();
threshold->SetInputConnection(jpgRead->GetOutputPort());
vtkDataSetSurfaceFilter* dataSurface = vtkDataSetSurfaceFilter::New();
dataSurface->SetInputConnection(threshold->GetOutputPort());
vtkPolyDataMapper* pMapper = vtkPolyDataMapper::New();
pMapper->SetInputConnection(dataSurface->GetOutputPort());
...
Note that you do not need to explicitly update each filter - the pipeline
will figure out when each filter needs to be updated.
Thanks,
Cory
On Fri, Oct 23, 2015 at 9:09 PM, tariq <tdinar at gmail.com> wrote:
> hi Cory,
> this is the code I wrote
> jpgRead->SetFileName(y.c_str());
> jpgRead->Update();
> imageData = jpgRead->GetOutput();
> imageThreshold->SetInputData(imageData);
> unsigned char lower = 250;
> unsigned char upper = 255;
> imageThreshold->ThresholdBetween(lower, upper);
> imageThreshold->ReplaceInOn();
> imageThreshold->SetInValue(255);
> imageThreshold->Update();
> dataSurface->DataSetExecute(imageThreshold->GetOutput(), pData);
> pMapper->SetInputData(pData);
> outputtActor->SetMapper(pMapper);
> outputtActor->GetProperty()->SetRepresentationToWireframe();
> inputActor->SetInputData(imageData);
>
> rendering input on the left and output on the right (wireframe). All the
> cells (black or white are propagated to the output). how can I get hold of
> the black cells only? I would settle for that, instead of the boundary of
> the black cells region.
> I appreciate the help.
> <
> http://vtk.1045678.n5.nabble.com/file/n5734545/Screen_Shot_2015-10-23_at_6.png
> >
> Thanks.
> T.
>
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Image-Blob-as-polydata-tp5734533p5734545.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
--
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151026/b7df5fc3/attachment.html>
More information about the vtkusers
mailing list