# [vtkusers] Unwrap a cylinder of data using vtkCylindricalTransform and vtkImageReslice

David Gobbi david.gobbi at gmail.com
Thu Dec 18 10:46:47 EST 2014

```On Thu, Dec 18, 2014 at 8:40 AM, David Gobbi <david.gobbi at gmail.com> wrote:
>
> On Thu, Dec 18, 2014 at 8:17 AM, Vincent32160 <vsh at magellium.fr> wrote:
>>
>> As I need to modify the angle from which the unrolling is starting I would
>> use the sophisticated solution you advise.
>> If I understand correctly the starting reslice axes are a 4x4 matrix
>> (-1,0,0,center[0],0,-1,0,center[1],0,0,1,center[2],0,0,0,0).
>> If I need to apply an angle, I could use only the 3x3 matrix
>> (-1,0,0,0,-1,0,0,0,1).
>> Can you tell me if I am right?
>> Thanks
>
>
> Yes, the 3x3 matrix controls the orientation of the cylinder, and
> the final column is where you want the center to be.
>
> However: the bottom row should always be (0,0,0,1).  And I'm
> not sure why you put in the "-1"s.  Is there a reason why you want
> to rotate by 180 degrees?
>

The third column of the 3x3 matrix must be a unit vector that points
along the axis of the cylinder.  The first and second columns must
be perpendicular to the third axis, and must be perpendicular to each
other (if they aren't, then the matrix isn't a rotation matrix).

The method vtkMath::Perpendiculars() can be used to compute the
three columns for the 3x3 matrix, if you know the axis of the cylinder.

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141218/cfeae831/attachment.html>
```