[vtkusers] vtkImageReslice - Rendering slice is stretched for oblique planes if no OutputExtent is set

Schröder, Tobias t.schroeder at Dkfz-Heidelberg.de
Tue Jan 17 02:39:30 EST 2012


Hi David,

Thanks for your help.
I think I'll revise the method computing the size of the plane and then set everything manually.
I also may have a look at vtkImageResliceMapper, but I don't think this will fit as we try to encapsulate the slice extraction in one responsible module for the whole MITK.

Regards,
Tobias


>2012/1/16 David Gobbi [mailto:david.gobbi at gmail.com] 
>
>Hi Tobias,
>
<I'll see if I can answer your questions in reverse order.
>
>The OutputExtent ivar is only used if you call SetOutputExtent(), otherwise it is ignored.  So the int min/max values that you saw are not used by vtkImageReslice, they just indicate that >you haven't called SetOutputExtent().
>
>If the ResliceAxes matrix is a permutation matrix (i.e. rotates by a multiple of 90 degrees), then the output's extent will be a permutation of the input's extent, and the output's spacing >will be a permutation of the input's spacing.  This is only true for the ResliceAxes, it is not true for the ResliceTransform.
>
>If the ResliceAxes is an oblique matrix, then by default ImageReslice should expand the extent to capture the full oblique slice.  If the input voxel spacing is the same in all three directions, >then the output will use the same voxel spacing.  If your voxel spacing is not the same in all directions, then I recommend that you call
>SetOutputSpacing() to indicate your desired output spacing.
>
>However, I do not recommend that you rely on this default behavior, in particular if you are dealing with medical images.  If you can compute the size of the plane, then you can also >compute the exact OutputSpacing, OutputExtent, and OutputOrigin to use with vtkImageReslice to generate the texture for that plane.  Or if you are willing to use the git version of VTK, >you can use one of the new classes like vtkImageResliceMapper.
>
> - David
>
>
>
>
>>2012/1/16 Schröder, Tobias <t.schroeder at dkfz-heidelberg.de>:
>> Hi All,
>>
>> I have a vtkPlaneSource where a slice from a volume is mapped. This 
>> plane is generated with a manually calculated size which is the 
>> largest possible region within the image for the oblique plane.
>>
>> When I leave the OutputExtent of the slice in vtkImageReslice to 
>> default the image is stretched in render window by factor 1.5 or so.
>>
>> When I set the extent with the method used for the plane, a vtk 
>> warning appears at some angles for rotated/oblique planes that the 
>> extent is at least one pixel outside the wholeExtent. It is 
>> vtkImageReslice who produces these warning.
>> So vtkImageReslice seems to know the boundary.
>>
>> I know the method has a rounding error which is not fixed yet. But 
>> that might not be a reason for the factor 1.5, because it is just one 
>> pixel (e.g. 255->256).
>>
>> As far as I understood the documentation there is no need to set the 
>> OutputExtent manually, as long as the largest possible extent is preferred.
>> The documentation says:
>> If no OutputExtent is set the extent is permuted through the reslice axis.
>>
>>Does vtkImageReslice really take the extent of the input for the output?
>>Calling GetOutputExtent() returns just the min and max integer values. 
>>Thus nothing seems to set.
>>
> >Any ideas?
>>
> >Regards,
>>
>> Tobias Schröder
>>
>> German Cancer Research Center (Deutsches Krebsforschungszentrum, DKFZ) 
>> Member of the Helmholtz Association Division Medical and Biological 
>> Informatics E130 Im Neuenheimer Feld 280
>>D-69120 Heidelberg
>>
>>
>> E-Mail: t.schroeder at dkfz-heidelberg.de
>> Web: www.dkfz.de



More information about the vtkusers mailing list