[vtkusers] VTKPolyData to 3D image

Lars Friedrich Lars lars-friedrich at gmx.net
Tue Apr 20 14:41:16 EDT 2010


Hi David,

no, I do not think that the image origin should be set to the polygonal object's center. The image origin (center of first voxel) is intuitionally the same point as the polygonal object's 'origin'. As the 'image orientation' is implicitly fixed in VTK (axis-aligned with direction cosines 1 0 0 0 1 0 0 0 1) the lower bounds point might be the origin of the volume image as well.

However, I am not really sure whether the image data and poly data are in the same coordinate system. In the morning I had the impression that the image is shifted relative to the polygonal object (sphere) by half of its spacing along its orientation. A few minutes ago, I had a look at it again using paraview for visualization. I increased the theta and phi resolution of the sphere (and also set its center to another point in space) and varied the spacing to get confidence. But I am still not 100%ly sure.

What offset are you monitoring? Sub-spacing-range or more?

regards,

lars



-------- Original-Nachricht --------
> Datum: Tue, 20 Apr 2010 12:12:08 -0500
> Von: David Welch <dmwelch at engineering.uiowa.edu>
> An: David Doria <daviddoria+vtk at gmail.com>, Lars Friedrich Lars <lars-friedrich at gmx.net>
> CC: vtkusers at vtk.org
> Betreff: Re: [vtkusers] VTKPolyData to 3D image

> Hi Lars,
> I can confirm that there is an offset to the images.  The origin is
> computed
> as the lower(?) bounds for x,y, and z.  I believe that these should be the
> average of the upper and lower bounds so as to obtain the center.
> Unfortunately, when I try to implement that in the code,
> PolyDataToImageStencil seg faults on it's update.  Any idea why that would
> be?
> 
> I'd also suggest adding additional space around the image so that the
> surface voxelization doesn't butt up against the image edges
> 
> Dave
> 
> On Tue, Apr 20, 2010 at 10:58 AM, David Doria
> <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> > wrote:
> 
> > On Tue, Apr 20, 2010 at 11:55 AM, David Welch
> > <dmwelch at engineering.uiowa.edu> wrote:
> > > This is my CMake file:
> > >
> > >
> > > PROJECT(SurfaceToImage) # Project name
> > > CMAKE_MINIMUM_REQUIRED( VERSION 2.6) # This is the minimum version of
> > CMake
> > >
> >
> #*******************************************************************************
> > > FIND_PACKAGE(VTK REQUIRED)
> > > IF (VTK_FOUND)
> > >   INCLUDE(${VTK_USE_FILE})
> > > ELSE (VTK_FOUND)
> > >   MESSAGE(ERROR "Cannot build without a VTK build tree or a VTK
> > > installation. Please set VTK_DIR.")
> > > ENDIF (VTK_FOUND)
> > >
> >
> #*******************************************************************************
> > > SET( SurfaceToImage_SOURCE SurfaceToImage.cxx )
> > > ADD_LIBRARY(SurfaceToImageLib SHARED ${SurfaceToImage_SOURCE})
> > > SET_TARGET_PROPERTIES (SurfaceToImageLib PROPERTIES COMPILE_FLAGS
> > > "-Dmain=ModuleEntryPoint")
> > > TARGET_LINK_LIBRARIES (SurfaceToImageLib vtkIO vtkFiltering vtkCommon
> > > vtkImaging)
> > > ADD_EXECUTABLE( SurfaceToImage ${SurfaceToImage_SOURCE})
> > > TARGET_LINK_LIBRARIES (SurfaceToImage vtkIO vtkCommon vtkFiltering
> > > vtkImaging)
> >
> > Yep, you need to add vtkHybrid to the list of libraries you are linking
> to.
> >
> > Thanks,
> >
> > David
> >
> 
> 
> 
> -- 
> David Welch
> Graduate Student
> Dept. of Biomedical Engineering
> University of Iowa
> Lab: (319) 335-5279

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the vtkusers mailing list