[Insight-users] crop tool with ITK VTK Qt

David Doria daviddoria at gmail.com
Mon May 13 09:36:47 EDT 2013


On Fri, May 10, 2013 at 8:17 AM, Cary lorey
<developement.unity at gmail.com> wrote:
> Hello,
>
>
> I am trying to read a DICOM series with ITK and display with VTK in
> QVTKWidget, so I want to build a tool with Qt  that allows  to make a crop
> (such as crop tool in photoshop), this tool lets you select a region on the
> first image of the series then apply the dimensions of the selection of all
> images in the DICOM series.
>
> First, I tested a sample crop without Qt in this link:
> http://www.vtk.org/Wiki/ITK/Examples/ImageProcessing/CropImageFilter
>
>   I also tested a sample program that supports drawing a rectangle on an
> image using vtkBorderWidget even without Qt:
> http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Widgets/Testing/Cxx/TestBorderWidget.cxx?root=VTK&content-type=text/plain
>
> I want to know is that vtkBorderWidget is a good method for a selection
> tool, or there is another way to select an area by a rectangle through the
> manipulation of the mouse?
>
> if the method of vtkBorderWidget is good, how can I keep only the area that
> I had selected?(as  crop tool in photoshop).
>
> I hope  that my problem is clear. thank you in advance.

The border widget is a good option. Here is an example that shows how
to get the corners of the selection:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/Border

You could also use vtkInteractorStyleRubberBand2D (demonstrated here:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/SelectWindowRegion)

Either way, once you get the bounds of the selection, I'd probably use
the itkExtractImageFilter
(http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ExtractImageFilter)
to do the cropping, then update the display (VTK) pipeline.

Good luck,

David


More information about the Insight-users mailing list