Re: Problem rotating vtkImageSlice

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get


which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick






_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Richard Frank
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank
On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick






_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick







_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Richard Frank
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick







_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick








_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Richard Frank
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick








_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick









_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Richard Frank
I need oblique slices 

Rick Frank

On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick









_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Richard Frank
In reply to this post by David Gobbi
I'm using image stack to implement manual registration of CT and XA modalities 

Rick Frank

On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick









_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Richard Frank
In reply to this post by David Gobbi
I thought I coil rotate the image slice in 3 space as defined here 


On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick









_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
Okay, let me try to understand this.  Please let me know if I'm wrong on any of the following points.

1) You have a CT scan, consisting of several slices (I assume around 100 slices) with uniform spacing.

2) You have a single XA image.  An XA is a projection image, in contrast to CT which is a tomographic image.

3) You need to find the direction-of-projection through the CT volume such that it matches the XA.

This is generally done by creating a DRR a MIP of the CT.  I'm not sure how you plan to achieve this by rotating a slice.

 - David

On Sun, Aug 28, 2016 at 3:09 PM, Richard Frank <[hidden email]> wrote:
I thought I coil rotate the image slice in 3 space as defined here 


On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick










_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
I meant DRR "or" MIP (Digitally Reconstructed Radiograph, Maximum Intensity Projection).

On Sun, Aug 28, 2016 at 3:41 PM, David Gobbi <[hidden email]> wrote:
Okay, let me try to understand this.  Please let me know if I'm wrong on any of the following points.

1) You have a CT scan, consisting of several slices (I assume around 100 slices) with uniform spacing.

2) You have a single XA image.  An XA is a projection image, in contrast to CT which is a tomographic image.

3) You need to find the direction-of-projection through the CT volume such that it matches the XA.

This is generally done by creating a DRR a MIP of the CT.  I'm not sure how you plan to achieve this by rotating a slice.

 - David

On Sun, Aug 28, 2016 at 3:09 PM, Richard Frank <[hidden email]> wrote:
I thought I coil rotate the image slice in 3 space as defined here 


On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick











_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Richard Frank
In reply to this post by David Gobbi
Hi David

I have a preop CT typically 600 - 900 slices.  The intra-op ct ( DICOM says modality is XA , essentially a lower res non - HU calibrated spin volume) is from a c-arm right before surgical procedure. I need to align the intra op with the preop. This is manual registration by moving 3 orthogonal slice pairs to create a 6 DOF registration matrix. My initial implementation of the slices ( Axial, sagittal, etc) has them all "facing" the user. Rolling the scroll wheel moves through the slices.

This is all parallel projection.

We have a dual volume renderer written in OpenCL that shows the alignment in 3D of the two ( fixed, moving ) volumes.

Now I would like to, for simplicity, align the 
slices so the world coordinates line up with my ijkLPS transform.
In the case of direction cosines == identity, HFS position, my sagittal slice can be aligned with world coordinates by turning it so the patient is head pointing out of screen (+Z Inferior - Superior), face down ( + Y Anterior to Posterior) ( +X Left to Right). 

The I would move the slice to proper location in space based on image position patient. ( one coordinate is always 0 ) And then move the camera so the slice normal is aligned with the camera view vector.

This is all working correctly with our 3D views and associated surgical equipment. I thought I would be able to manipulate the slices in space as any other actor ( rotate, translate, etc) but perhaps that's not possible? When I try to rotate the image slice ( which is a Prop3D) the image seems to be resliced  as you say, instead of the prop being rotated.

Thanks 

Rick Frank

On Aug 28, 2016, at 5:41 PM, David Gobbi <[hidden email]> wrote:

Okay, let me try to understand this.  Please let me know if I'm wrong on any of the following points.

1) You have a CT scan, consisting of several slices (I assume around 100 slices) with uniform spacing.

2) You have a single XA image.  An XA is a projection image, in contrast to CT which is a tomographic image.

3) You need to find the direction-of-projection through the CT volume such that it matches the XA.

This is generally done by creating a DRR a MIP of the CT.  I'm not sure how you plan to achieve this by rotating a slice.

 - David

On Sun, Aug 28, 2016 at 3:09 PM, Richard Frank <[hidden email]> wrote:
I thought I coil rotate the image slice in 3 space as defined here 


On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick










_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
Rotating the vtkImageSlice (i.e. the actor) rotates the data with respect to world coords.  Rotating the SlicePlane of the vtkImageResliceMapper rotates the cut plane wrt world coords.  So between these, you have full control over both the data-to-world transformation, and over the cut plane that you want to use to extract an oblique slice from the rotated data.  So what you are trying to do is definitely possible.

Here is the code that I use to display images for registration:

 - David

On Sun, Aug 28, 2016 at 4:52 PM, Richard Frank <[hidden email]> wrote:
Hi David

I have a preop CT typically 600 - 900 slices.  The intra-op ct ( DICOM says modality is XA , essentially a lower res non - HU calibrated spin volume) is from a c-arm right before surgical procedure. I need to align the intra op with the preop. This is manual registration by moving 3 orthogonal slice pairs to create a 6 DOF registration matrix. My initial implementation of the slices ( Axial, sagittal, etc) has them all "facing" the user. Rolling the scroll wheel moves through the slices.

This is all parallel projection.

We have a dual volume renderer written in OpenCL that shows the alignment in 3D of the two ( fixed, moving ) volumes.

Now I would like to, for simplicity, align the 
slices so the world coordinates line up with my ijkLPS transform.
In the case of direction cosines == identity, HFS position, my sagittal slice can be aligned with world coordinates by turning it so the patient is head pointing out of screen (+Z Inferior - Superior), face down ( + Y Anterior to Posterior) ( +X Left to Right). 

The I would move the slice to proper location in space based on image position patient. ( one coordinate is always 0 ) And then move the camera so the slice normal is aligned with the camera view vector.

This is all working correctly with our 3D views and associated surgical equipment. I thought I would be able to manipulate the slices in space as any other actor ( rotate, translate, etc) but perhaps that's not possible? When I try to rotate the image slice ( which is a Prop3D) the image seems to be resliced  as you say, instead of the prop being rotated.

Thanks 

Rick Frank

On Aug 28, 2016, at 5:41 PM, David Gobbi <[hidden email]> wrote:

Okay, let me try to understand this.  Please let me know if I'm wrong on any of the following points.

1) You have a CT scan, consisting of several slices (I assume around 100 slices) with uniform spacing.

2) You have a single XA image.  An XA is a projection image, in contrast to CT which is a tomographic image.

3) You need to find the direction-of-projection through the CT volume such that it matches the XA.

This is generally done by creating a DRR a MIP of the CT.  I'm not sure how you plan to achieve this by rotating a slice.

 - David

On Sun, Aug 28, 2016 at 3:09 PM, Richard Frank <[hidden email]> wrote:
I thought I coil rotate the image slice in 3 space as defined here 


On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick











_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Richard Frank
Thanks I'll take a look!

Rick Frank

On Aug 28, 2016, at 7:21 PM, David Gobbi <[hidden email]> wrote:

Rotating the vtkImageSlice (i.e. the actor) rotates the data with respect to world coords.  Rotating the SlicePlane of the vtkImageResliceMapper rotates the cut plane wrt world coords.  So between these, you have full control over both the data-to-world transformation, and over the cut plane that you want to use to extract an oblique slice from the rotated data.  So what you are trying to do is definitely possible.

Here is the code that I use to display images for registration:

 - David

On Sun, Aug 28, 2016 at 4:52 PM, Richard Frank <[hidden email]> wrote:
Hi David

I have a preop CT typically 600 - 900 slices.  The intra-op ct ( DICOM says modality is XA , essentially a lower res non - HU calibrated spin volume) is from a c-arm right before surgical procedure. I need to align the intra op with the preop. This is manual registration by moving 3 orthogonal slice pairs to create a 6 DOF registration matrix. My initial implementation of the slices ( Axial, sagittal, etc) has them all "facing" the user. Rolling the scroll wheel moves through the slices.

This is all parallel projection.

We have a dual volume renderer written in OpenCL that shows the alignment in 3D of the two ( fixed, moving ) volumes.

Now I would like to, for simplicity, align the 
slices so the world coordinates line up with my ijkLPS transform.
In the case of direction cosines == identity, HFS position, my sagittal slice can be aligned with world coordinates by turning it so the patient is head pointing out of screen (+Z Inferior - Superior), face down ( + Y Anterior to Posterior) ( +X Left to Right). 

The I would move the slice to proper location in space based on image position patient. ( one coordinate is always 0 ) And then move the camera so the slice normal is aligned with the camera view vector.

This is all working correctly with our 3D views and associated surgical equipment. I thought I would be able to manipulate the slices in space as any other actor ( rotate, translate, etc) but perhaps that's not possible? When I try to rotate the image slice ( which is a Prop3D) the image seems to be resliced  as you say, instead of the prop being rotated.

Thanks 

Rick Frank

On Aug 28, 2016, at 5:41 PM, David Gobbi <[hidden email]> wrote:

Okay, let me try to understand this.  Please let me know if I'm wrong on any of the following points.

1) You have a CT scan, consisting of several slices (I assume around 100 slices) with uniform spacing.

2) You have a single XA image.  An XA is a projection image, in contrast to CT which is a tomographic image.

3) You need to find the direction-of-projection through the CT volume such that it matches the XA.

This is generally done by creating a DRR a MIP of the CT.  I'm not sure how you plan to achieve this by rotating a slice.

 - David

On Sun, Aug 28, 2016 at 3:09 PM, Richard Frank <[hidden email]> wrote:
I thought I coil rotate the image slice in 3 space as defined here 


On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick











_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
Also see the ImageResliceMapperOffAxis test (and the other tests in Rendering/Image/Testing/Cxx):


On Sun, Aug 28, 2016 at 5:27 PM, Richard Frank <[hidden email]> wrote:
Thanks I'll take a look!

Rick Frank

On Aug 28, 2016, at 7:21 PM, David Gobbi <[hidden email]> wrote:

Rotating the vtkImageSlice (i.e. the actor) rotates the data with respect to world coords.  Rotating the SlicePlane of the vtkImageResliceMapper rotates the cut plane wrt world coords.  So between these, you have full control over both the data-to-world transformation, and over the cut plane that you want to use to extract an oblique slice from the rotated data.  So what you are trying to do is definitely possible.

Here is the code that I use to display images for registration:

 - David

On Sun, Aug 28, 2016 at 4:52 PM, Richard Frank <[hidden email]> wrote:
Hi David

I have a preop CT typically 600 - 900 slices.  The intra-op ct ( DICOM says modality is XA , essentially a lower res non - HU calibrated spin volume) is from a c-arm right before surgical procedure. I need to align the intra op with the preop. This is manual registration by moving 3 orthogonal slice pairs to create a 6 DOF registration matrix. My initial implementation of the slices ( Axial, sagittal, etc) has them all "facing" the user. Rolling the scroll wheel moves through the slices.

This is all parallel projection.

We have a dual volume renderer written in OpenCL that shows the alignment in 3D of the two ( fixed, moving ) volumes.

Now I would like to, for simplicity, align the 
slices so the world coordinates line up with my ijkLPS transform.
In the case of direction cosines == identity, HFS position, my sagittal slice can be aligned with world coordinates by turning it so the patient is head pointing out of screen (+Z Inferior - Superior), face down ( + Y Anterior to Posterior) ( +X Left to Right). 

The I would move the slice to proper location in space based on image position patient. ( one coordinate is always 0 ) And then move the camera so the slice normal is aligned with the camera view vector.

This is all working correctly with our 3D views and associated surgical equipment. I thought I would be able to manipulate the slices in space as any other actor ( rotate, translate, etc) but perhaps that's not possible? When I try to rotate the image slice ( which is a Prop3D) the image seems to be resliced  as you say, instead of the prop being rotated.

Thanks 

Rick Frank

On Aug 28, 2016, at 5:41 PM, David Gobbi <[hidden email]> wrote:

Okay, let me try to understand this.  Please let me know if I'm wrong on any of the following points.

1) You have a CT scan, consisting of several slices (I assume around 100 slices) with uniform spacing.

2) You have a single XA image.  An XA is a projection image, in contrast to CT which is a tomographic image.

3) You need to find the direction-of-projection through the CT volume such that it matches the XA.

This is generally done by creating a DRR a MIP of the CT.  I'm not sure how you plan to achieve this by rotating a slice.

 - David

On Sun, Aug 28, 2016 at 3:09 PM, Richard Frank <[hidden email]> wrote:
I thought I coil rotate the image slice in 3 space as defined here 


On Aug 28, 2016, at 3:42 PM, David Gobbi <[hidden email]> wrote:

Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?

On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <[hidden email]> wrote:
I'm just trying to rotate the plane in 3 space, not reslicing...

Rick Frank

On Aug 28, 2016, at 3:16 PM, David Gobbi <[hidden email]> wrote:

If you only had one input slice, then why would you be surprised that reslicing at 90 degrees gives an output that is only one pixel wide?

On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <[hidden email]> wrote:
Hi

I'm using the VTK example which creates an in memory single cyan slice.....

Thanks

Rick Frank

On Aug 28, 2016, at 2:42 PM, David Gobbi <[hidden email]> wrote:

Check the extent of the input image to make sure all of the slices were loaded.

On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <[hidden email]> wrote:
Hi David,

Sorry about the attachment.

Well, I'm pretty far along with my work on this, so I'd like to try the vtkPlane orientation as a solution if possible.

using the example code,  If I create a vtkPlane, set its origin to 0,0,0 and set its normal to 1 0 0 (instead of 0,0,1) and call
 imageResliceMapper->SetSlicePlane(plane);

I see a thin line. Seems correct. If I change the interactor style to Trackball camera, and rotate the camera around it seems the image is only 1 unit wide however.

Is there something else I need to do to get the image to map to a plane with different orientation?

THanks
Rick Frank

On Aug 28, 2016, at 12:51 PM, David Gobbi <[hidden email]> wrote:

Hi Frank,

It looks like you are doing a data transformation when you should be doing a view transformation.  Don't rotate the actor if your goal is to rotate the view.  When you rotate the actor, you are changing the relationship between data coordinates and world coordinates. 

If you want a sagittal view, then you can rotate the view by moving the VTK camera.  The mapper has a method SliceFacesCameraOn() that can be used to make the mapper automatically extract a slice in the correct orientation.

Also, please limit the width of inlined images to around 1000 pixels or less.  Large inlined images make your email hard to read on my system (I wish that gmail would auto-shrink oversized inlined images, but unfortunately it displays them full-size, even if they're several times the size of the display).

 - David

On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <[hidden email]> wrote:
Hi David,

Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....

So, I have 3 slice views and in the screenshot the Axial View is lined up appropriately (image position patient is in the correct place, and each slice is in correct place etc) with the world coordinates by using the image reslice axis and camera etc to align the DICOM coordinates and the VTK World coordinates.

I now want to orient the sagittal slice so that it aligns with the world coordinates.

(see screen shots)


I believe I need to rotate the slice (if I could rotate the actor) about Z 90 CCW and then about its new X 0- degrees and then move the camera about world Y 90 and the roll the camera 90 to get the sagittal voxels DICOM aligned with the World Coordinates.

I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.

How would I use the SetSlicePlane to achieve this?

Thanks

Rick

On Aug 27, 2016, at 02:51 PM, David Gobbi <[hidden email]> wrote:

You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,
perhaps its behavior will better suit your requirements.


On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <[hidden email]> wrote:
Hi Rick,

You're seeing this because you are doing an out-of-plane rotation on an image that has only one slice.  The rotation is around the image origin, which (in this case) is at the bottom-left corner of the image.

The vtkImageResliceMapper has a SetSlicePlane() method:
You must rotate this SlicePlane when you rotate the vtkImageSlice.

 - David



On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <[hidden email]> wrote:
Hi,

If I build the example

VTK/Examples/Cxx/Images/ImageSlice

and add

 imageSlice->RotateX(1);

Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get



which seems incorrect.

I can rotate about Z.

Is there something I'm not doing correctly, or is this a bug?

I also tried RotateWXYZ(1,1,0,0) and get the same result.

This is VTK 7

Thanks

Rick












_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers

TestImageResliceMapperOffAxis.png (62K) Download Attachment
Ang
Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

Ang
In reply to this post by David Gobbi
Hi David,

I would like to flip around X axis for vtkImageSlice (not original pixel data ,just flip actor),below is my code.

//***********************************************//
double *tranlate = imageSlice->GetCenter();

vtkTransform *trans = vtkTransform::New();
trans->PostMultiply();

trans->Translate(-tranlate[0], -tranlate[1], -tranlate[2]);
trans->RotateY(180);
trans->Translate(tranlate[0], tranlate[1], tranlate[2]);

imageSlice->PokeMatrix(trans->GetMatrix());
//***********************************************//

As your mentioned in the thread, I cant rotate the vtkImageSlice by using vtkMatrix so I got wrong result.

Would you have some suggestion to  flip around X axis for vtkImageSlice?

Reply | Threaded
Open this post in threaded view
|

Re: Problem rotating vtkImageSlice

David Gobbi
Hi Ang,

The PokeMatrix() method is an internal method that VTK uses for picking.  If you use it for rendering, it might corrupt the state of the VTK pipeline.

Use SetUserMatrix() instead.

 - David


On Tue, Apr 18, 2017 at 1:50 AM, Ang <[hidden email]> wrote:
Hi David,

I would like to flip around X axis for vtkImageSlice (not original pixel
data ,just flip actor),below is my code.

//***********************************************//
double *tranlate = imageSlice->GetCenter();

vtkTransform *trans = vtkTransform::New();
trans->PostMultiply();

trans->Translate(-tranlate[0], -tranlate[1], -tranlate[2]);
trans->RotateY(180);
trans->Translate(tranlate[0], tranlate[1], tranlate[2]);

imageSlice->PokeMatrix(trans->GetMatrix());
//***********************************************//

As your mentioned in the thread, I cant rotate the vtkImageSlice by using
vtkMatrix so I got wrong result.

Would you have some suggestion to  flip around X axis for vtkImageSlice?

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers