<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Thanks I'll take a look!<br><br>Rick Frank</div><div><br>On Aug 28, 2016, at 7:21 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">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.<div><br></div><div>Here is the code that I use to display images for registration:</div><div><a href="https://github.com/dgobbi/AIRS/blob/master/Programs/register.cxx#L1994">https://github.com/dgobbi/AIRS/blob/master/Programs/register.cxx#L1994</a><br></div><div><br></div><div> - David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 28, 2016 at 4:52 PM, Richard Frank <span dir="ltr"><<a href="mailto:rickfrank@me.com" target="_blank">rickfrank@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Hi David</div><div><br></div><div>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.</div><div><br></div><div>This is all parallel projection.</div><div><br></div><div>We have a dual volume renderer written in OpenCL that shows the alignment in 3D of the two ( fixed, moving ) volumes.</div><div><br></div><div>Now I would like to, for simplicity, align the <br>slices so the world coordinates line up with my ijkLPS transform.</div><div>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). </div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Thanks </div><div><br>Rick Frank</div><div><div class="h5"><div><br>On Aug 28, 2016, at 5:41 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Okay, let me try to understand this.  Please let me know if I'm wrong on any of the following points.<div><br></div><div>1) You have a CT scan, consisting of several slices (I assume around 100 slices) with uniform spacing.</div><div><br></div><div>2) You have a single XA image.  An XA is a projection image, in contrast to CT which is a tomographic image.</div><div><br></div><div>3) You need to find the direction-of-projection through the CT volume such that it matches the XA.</div><div><br></div><div>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.</div><div><br></div><div> - David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 28, 2016 at 3:09 PM, Richard Frank <span dir="ltr"><<a href="mailto:rickfrank@me.com" target="_blank">rickfrank@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I thought I coil rotate the image slice in 3 space as defined here </div><div><br></div><div><a href="http://www.vtk.org/doc/nightly/html/classvtkImageSlice.html#details" target="_blank">http://www.vtk.org/doc/nightly<wbr>/html/classvtkImageSlice.html#<wbr>details</a><br><br>Rick Frank</div><div><div><div><br>On Aug 28, 2016, at 3:42 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Then remind me again why you're using vtkImageResliceMapper instead of vtkImageSliceMapper?</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 28, 2016 at 1:23 PM, Richard Frank <span dir="ltr"><<a href="mailto:rickfrank@me.com" target="_blank">rickfrank@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I'm just trying to rotate the plane in 3 space, not reslicing...</div><div><br>Rick Frank</div><div><div><div><br>On Aug 28, 2016, at 3:16 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>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?</div><div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 28, 2016 at 12:53 PM, Richard Frank <span dir="ltr"><<a href="mailto:rickfrank@me.com" target="_blank">rickfrank@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Hi</div><div><br></div><div>I'm using the VTK example which creates an in memory single cyan slice.....</div><div><br></div><div>Thanks<br><br>Rick Frank</div><div><div><div><br>On Aug 28, 2016, at 2:42 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Check the extent of the input image to make sure all of the slices were loaded.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 28, 2016 at 12:37 PM, Richard Frank <span dir="ltr"><<a href="mailto:rickfrank@me.com" target="_blank">rickfrank@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hi David,<br></div><div><br></div><div>Sorry about the attachment.<br></div><div><br></div><div>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.<br></div><div><br></div><div>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 <br></div><div> imageResliceMapper->SetSliceP<wbr>lane(plane);</div><div><br></div><div>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.<br></div><div><br></div><div>Is there something else I need to do to get the image to map to a plane with different orientation?</div><div><br></div><div>THanks</div><div>Rick Frank<div><div><br>On Aug 28, 2016, at 12:51 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br><br><div><blockquote type="cite"><div><div dir="ltr">Hi Frank,<div><br></div><div>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. </div><div><div class="gmail_extra"><br></div><div class="gmail_extra">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.</div><div class="gmail_extra"><br></div><div class="gmail_extra">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).</div><div class="gmail_extra"><br></div><div class="gmail_extra"> - David</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 28, 2016 at 9:56 AM, Richard Frank <span dir="ltr"><<a href="mailto:rickfrank@me.com" target="_blank">rickfrank@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid #cccccc;padding-left:1ex"><div><div>Hi David,<br></div><div><br></div><div>Thanks for the reply. I'm still a bit confused about what I've tried and why it doesn't work....<br></div><div><br></div><div>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.<br></div><div><br></div><div>I now want to orient the sagittal slice so that it aligns with the world coordinates.<br></div><div><br></div><div>(see screen shots)<br></div><div><br></div><div><br></div><div>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. <br></div><div><br></div><div>I tried various parameters for the resliceMapper->SetSlicePlane() but the slice just dissapears off screen somewhere so I must be getting sometime wrong.<br></div><div><br></div><div>How would I use the SetSlicePlane to achieve this?</div><div><br></div><div>Thanks</div><div><br></div><div>Rick</div><div><span><br>On Aug 27, 2016, at 02:51 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br><br></span><div><blockquote type="cite"><div><span><div dir="ltr">You should also try vtkImageSliceMapper instead of vtkImageResliceMapper,<div>perhaps its behavior will better suit your requirements.<br><div><br></div></div></div></span><div class="gmail_extra"><br><div class="gmail_quote"><span>On Sat, Aug 27, 2016 at 11:51 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid #cccccc;padding-left:1ex"><span><div dir="ltr">Hi Rick,<div><br></div><div>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.</div><div><br></div><div>The vtkImageResliceMapper has a SetSlicePlane() method:</div><div><a href="http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes#vtkImageResliceMapper" target="_blank">http://www.vtk.org/Wiki/VTK/Im<wbr>age_Rendering_Classes#vtkImage<wbr>ResliceMapper</a><br></div><div>You must rotate this SlicePlane when you rotate the vtkImageSlice.</div><span><span style="color:#888888"><div><br></div><div> - David</div><div><br></div><div><br></div></span></span></div></span><div><div><div class="gmail_extra"><br><div class="gmail_quote"><span>On Sat, Aug 27, 2016 at 10:54 AM, Richard Frank <span dir="ltr"><<a href="mailto:rickfrank@me.com" target="_blank">rickfrank@me.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid #cccccc;padding-left:1ex"><div><span><div>Hi,<br></div><div><br></div><div>If I build the example <br></div><div><br></div></span><div><span><h1 lang="en"><span style="font-size:12px" dir="auto">VTK/Examples/Cxx/Images/ImageS<wbr>lice</span></h1><div><span dir="auto">and add<br></span></div><div><span dir="auto"><br></span></div><div><span dir="auto"> imageSlice->RotateX(1);</span></div><div><span dir="auto"><br></span></div><div><span dir="auto">Which should, I think, rotate the image actor about its X axis by 1 degree, I instead get<br></span></div><div><span dir="auto"><br></span></div><div><br></div><div><br></div></span><span><div>which seems incorrect.<br></div><div><br></div><div>I can rotate about Z.<br></div><div><br></div><div>Is there something I'm not doing correctly, or is this a bug?<br></div><div><br></div><div>I also tried RotateWXYZ(1,1,0,0) and get the same result.<br></div><div><br></div><div>This is VTK 7<br></div><div><br></div><div>Thanks<br></div><div><br></div><div>Rick<br></div><div><br></div><div><br></div></span></div></div></blockquote></div><br></div></div></div></blockquote></div><br></div></div></blockquote></div></div></div></blockquote></div><br></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div><br></div>
</div></blockquote></div></div></div></blockquote></div><br></div>
</div></blockquote></div></div></div></blockquote></div><br></div>
</div></blockquote></div></div></div></blockquote></div><br></div>
</div></blockquote></div></div></div></blockquote></div><br></div>
</div></blockquote></body></html>