[vtkusers] Fwd: non-square image "cropped" after rotate 90º

Marcos fotosentido at gmail.com
Wed Sep 16 18:24:25 EDT 2015


Hi,

I tried before woth SetResliceAxes, but I didn't get how to use a
vtkMatrix4x4 as I said in another post.

It was working with SetResliceTransform, until I saw that.


I tried to do this:

void ViewerWidget::rotateCalculate(int angle, double axis[])

{

    double bounds[6];

    con->GetOutput()->GetBounds(bounds);

    double center[3];

    center[0] = (bounds[1] + bounds[0]) / 2.0;

    center[1] = (bounds[3] + bounds[2]) / 2.0;

    center[2] = (bounds[5] + bounds[4]) / 2.0;

    transform->Translate(center[0], center[1], center[2]);

    transform->RotateWXYZ(angle, axis);

    transform->Translate(-center[0], -center[1], -center[2]);

    reslicer->SetResliceTransform(transform);


    // added this line,

    reslicer->SetOutputExtent(bounds[2], bounds[3], bounds[0], bounds[1],

            bounds[4], bounds[5]);


    reslicer->Update();

}


I got an exception : read access violation on vtkImageMapToWindowLevelColors
::ThreadedRequestData
even with square images.

The bound values for a non square-image (multiframe):
299.5, 898.5, 214.5, 643.5, 4.5, 13.5

The bound values for the square image (multiframe):
127.5, 382.5, 127.5, 382.5, 521.024, 1563.0749


2015-09-16 22:49 GMT+02:00 David Gobbi <david.gobbi at gmail.com>:

> On Wed, Sep 16, 2015 at 1:46 PM, Siavash Khallaghi <siavashk at ece.ubc.ca>
> wrote:
>
>> Hi Marcos,
>>
>> Can you compare the extent of the output of vtkImageReslice against its
>> input? My gut feeling is that they are not equal.
>>
>
> I suggest to use SetResliceAxes() (using transform->GetMatrix()) instead of
> SetResliceTransform.  Here is why:
>
> When you use SetResliceAxes(), vtkImageReslice will transform the input
> sampling (i.e. the extent and spacing) so that the output extent is
> rotated as
> compared to the input extent.
>
> Another option is to manually set the output extent, with
> reslice->SetOutputExtent().
>
>  - David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150917/5553c845/attachment-0001.html>


More information about the vtkusers mailing list