[vtkusers] Extract a tube of data from DICOM series data

David Gobbi david.gobbi at gmail.com
Thu Nov 6 08:28:36 EST 2014


Hi Vincent,

Two notes:

1) you'll have to adjust the Window/Level, using e.g. these:
extractedActor->GetProperty()->SetColorWindow(4000.0);
extractedActor->GetProperty()->SetColorLevel(2000.0);

2) the vtkImageActor will only ever show one slice at a time,
if you want to show the whole volume you will have to use a
volume mapper.

 - David

On Thu, Nov 6, 2014 at 3:36 AM, Vincent32160 <vsh at magellium.fr> wrote:

> Thanks David.
>
> I used the objects you pointed and it works but the image is like a contour
> and looks to contains no data (black and white picture). Below is the code.
>
> // Read all the DICOM files in the specified directory.
> vtkSmartPointer<vtkDICOMImageReader> reader =
> vtkSmartPointer<vtkDICOMImageReader>::New();
> reader->SetDirectoryName(directory);
> reader->Update();
>
> // Change the kind of data we handle
> vtkSmartPointer<vtkImageShiftScale> scale =
> vtkSmartPointer<vtkImageShiftScale>::New();
> scale->SetInputConnection(reader->GetOutputPort());
> scale->SetOutputScalarTypeToUnsignedShort();
> scale->Update();
>
> vtkROIStencilSource * stencilSource = vtkROIStencilSource::New();
> stencilSource->SetShapeToCylinderZ();
> stencilSource->SetBounds(scale->GetOutput()->GetBounds());
> stencilSource->SetInformationInput(scale->GetOutput());
> stencilSource->Print(std::cout);
>
> vtkImageStencil * stencilFilter = vtkImageStencil::New();
> stencilFilter->SetInputConnection(scale->GetOutputPort());
> stencilFilter->SetStencilConnection(stencilSource->GetOutputPort());
> stencilFilter->Update();
>
> vtkImageSliceMapper * imageMapper3d = vtkImageSliceMapper::New();
>   imageMapper3d->SetInputConnection(stencilFilter->GetOutputPort());
>
> vtkSmartPointer<vtkImageActor> extractedActor =
> vtkSmartPointer<vtkImageActor>::New();
>   extractedActor->SetMapper(imageMapper3d);
>
> Here is the result:
> <http://vtk.1045678.n5.nabble.com/file/n5729390/output.png>
> On the left the input volume data (from the DICOM series) and on the right
> the display of extractedActor (cf code). I would like to get a part of the
> input volume as a result and not a single black and white slice.
>
> Thanks again.
>
> Vincent
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Extract-a-tube-of-data-from-DICOM-series-data-tp5729381p5729390.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
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141106/d66d19f3/attachment.html>


More information about the vtkusers mailing list