Hello David <br><br>I think i got rid of all the problems (like the squeezed slices etc.) but I have some questions for you on your very first reply, since in some cases I get unexpected results or no results (empty slices). <br><br>1) you mentioned there that the relationship between the coordinates of the input coordinate system (denoted x) and the output coordinate sytem (denoted x') is the following: x=T*M*x' , where T is ResliceTransform and M is resliceMatrix. <br> <br>Isn't it the other way around? Like : x'=T*M*x ...<br><br>2) In my case after registering the virtual head with the real patient / head, I have a transformation that gives me for every point of the "Input coordinate system" or real space, the coordinates of it in the "output coordinate system" or virtual space. In that case should I set ResliceTransform to Identity? <br><br>3) I asked this question in another thread but got no reply yet (so i thought i should ask it here as well).I am getting
info regarding the rotation of the tool in quaternions. There is a method in vtkMath that gives a 3x3 rotation matrix from a quaternion. So I use the following lines of code to set up the 4x4 matrix that wiill feed the ResliceAxes with: <br><br>vtkMath* math=vtkMath::New();<br>float quat3To3[3][3];<br> <br> float quat[4]={0,0,0,0};<br><br>quat[0]=newPosition[0];<br>quat[1]=newPosition[1];<br>quat[2]=newPosition[2];<br>quat[3]=newPosition[3];<br>math->QuaternionToMatrix3x3(quat,quat3To3); <br>math->Delete();<br> <br> static double obliqueSliceElements[16] = {<br> quat3To3[0][0], quat3To3[0][1], quat3To3[0][2], 0,<br> quat3To3[1][0], quat3To3[1][1], quat3To3[1][2], 0,<br> quat3To3[2][0], quat3To3[2][1], quat3To3[2][2], 0,<br> 0, 0, 0, 1 };<br><br>Is it correct? <br><br>4)
Is there a way to calculate the Extent of a slice produced by the reslice? It is obvious that it depends on the angle(s) in which the plane cuts the entire volume. <br>But it seems tough to calculate.<br><br>Hope that wasn't too much. Thanks for the help <br><br><b><i>David Gobbi <dgobbi@atamai.com></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> Hi Emmanouil,<br><br>The "squeezing" is a result of anisotropic voxels. In your case it <br>sounds like the slice spacing is much larger than the pixel spacing. <br>There are a couple things that you need to be careful about:<br><br>1) When you create your vtkImageData objects, make sure that you call <br>SetSpacing(xs,ys,zs) with the correct values, the third value must be <br>set to the spacing between slices.<br><br>(note: if you are creating your vtkImageData objects from scratch, you <br>won't have to use vtkImageImport)<br><br>2) When
you use vtkImageReslice, you will probably want to call <br>SetOutputSpacing(ss,ss,ss) where "ss" is the smallest voxel dimension. <br>This will force vtkImageReslice to produce isotropic voxels, which <br>should get rid of the squeezing that you see.<br><br>Note that (2) is not the only way to get rid of the squeezing. If you <br>display the image with vtkImageActor, then vtkImageActor will <br>automatically stretch the texture to make the image look right, and in <br>this case (2) will be unnecessary.<br><br> - David<br><br><br><br>Emmanouil Moschidis wrote:<br>> Hello again. After reading the pixels form the memory I store every <br>> image in a vtkImageData object and then I use a vtkImageAppend obbject <br>> to add all the images there and thus create a volume.Then I set it as <br>> input to the vtkImageReslice object(btw do i really need a vtkImport <br>> object? ).<br>><br>> However when I get the slice after the reslicing is prerformed it
<br>> seems it is a bit squeezed when I compare it with the orthogonal slice <br>> I get from the DICOM viewer. Is there a way of "stretching" the image <br>> i get?<br>><br>> */David Gobbi <dgobbi@atamai.com>/* wrote:<br>><br>> Hi Emmanouil,<br>><br>> If you are reading DICOM files from disk, you need to use the<br>> vtkDICOMImageReader instead of vtkImageReader2.<br>><br>> If you search the mailing list archive for "DICOM" you will<br>> get lots of information (perhaps an overload) about reading<br>> DICOM into VTK.<br>><br>> - David<br>><br>><br>> Emmanouil Moschidis wrote:<br>> > Hi again I decided to go the easy way and read from the hard<br>> disk. So<br>> > I get the path of the already loaded series, but I get the error<br>> ><br>> > Could not open file<br>> >
/Users/osirix/Documents/Emmanouil/MyTestImages/MRkid/05050914/.1<br>> ><br>> > the path is<br>> /Users/osirix/Documents/Emmanouil/MyTestImages/MRkid/05050914/<br>> > even when I hardcode the path i get the same result. Do you know<br>> what<br>> > might be wrong? (btw is the last forward slash necessary ? )<br>> ><br>> > */David Gobbi /* wrote:<br>> ><br>> > Hi Emmanouil,<br>> ><br>> > One thing you can do is create a vtkImageImport object for each<br>> DICOM<br>> > image, this will allow you to create a vtkImageData from each<br>> > DICOM that<br>> > you have stored in memory. Then, you can use vtkImageAppend to<br>> create<br>> > an image volume out of the series of images. The output of<br>> > vtkImageAppend can be used by vtkImageReslice.<br>> ><br>> > - David<br>>
><br>> ><br>> > Emmanouil Moschidis wrote:<br>> > > Before being able to use some parts of the code I have to solve a<br>> > > different problem. (I posted a new question but either it was not<br>> > > quite clear or nobody has done that before (?) )<br>> > ><br>> > > I work within a DICOM viewer so the DICOM series are already<br>> > loaded (I<br>> > > do not read from a file like in case of the vtkImageReader2).<br>> > Actually<br>> > > every DICOM image is stored in a custom class and all together<br>> in a<br>> > > NSArray (yes it is objective-C). So I want to load the images<br>> > from the<br>> > > NSArray to the vtkImageReader2 object... I am not sure how<br>> > should I do<br>> > > that.<br>> > ><br>> > > Maybe first I need to load them into a
vtkImageData object?<br>> > (still I<br>> > > haven't found any example for that)<br>> > ><br>> > > And then again I have the problem how to get the output<br>> > properly. But<br>> > > I guess these questions do not belong to this class.<br>> > ><br>> > > */David Gobbi /* wrote:<br>> > ><br>> > > Hi Emmanouil,<br>> > ><br>> > > The best example for what you are trying to do is probably<br>> this one:<br>> > ><br>> > > VTK/Examples/ImageProcessing/Cxx/ImageSlicing.cxx<br>> > ><br>> > > This example is only in the CVS version of VTK, it isn't in the<br>> > VTK 5<br>> > > release.<br>> > ><br>> > > What I do with tracking systems is use the coordinate/quaternion<br>> > from<br>> > > the tracking
system to create a vtkTransform, then I concatenate<br>> > that<br>> > > transform with a vtkMatrix4x4 from the patient registration, and<br>> > then<br>> > > feed the resulting transform to vtkImageReslice as the<br>> > > ResliceTransform.<br>> > ><br>> > > If you have looked at the class page for vtkImageReslice, you will<br>> > > notice that there are two methods for setting orientations:<br>> > > SetResliceAxes() and SetResliceTransform().<br>> > ><br>> > > For tracking, I always set ResliceTransform to the<br>> > > position/orientation<br>> > > of the tool (in patient coordinates), and then set the ResliceAxes<br>> > > according to how I want to orient the slice relative to<br>> > > orientation of<br>> > > the tool. In that way, the ResliceAxes is used to choose the
tool<br>> > > axes<br>> > > along which you will be extracting the slice.<br>> > ><br>> > > The tricky thing with vtkImageReslice is getting the OutputOrigin,<br>> > > OutputSpacing, and OutputExtent set properly for your application.<br>> > > Together, these parameters can be used to describe an output slice<br>> > > plane<br>> > > with a particular pixel spacing. So for example:<br>> > ><br>> > > OutputOrigin = (-127.5, -127.5, 0.0)<br>> > > OutputSpacing = (1.0, 1.0, 1.0)<br>> > > OutputExtent = (0, 255, 0, 255, 0, 0)<br>> > ><br>> > > These describe a 256x256 output slice with 1mm pixel spacing. The<br>> > > first<br>> > > pixel is at (-127.5,-127.5,0) in the "output coordinate system" of<br>> > > vtkImageReslice. The centre of the slice is at (0,0,0)
in the<br>> > "output<br>> > > coordinate system" of vtkImageReslice.<br>> > ><br>> > > Now, the original input volume is in the "input coordinate<br>> > system" of<br>> > > vtkImageReslice. We can call the input coordinate system "x"<br>> and the<br>> > > output coordinate system "x'". The relationship between these<br>> > > coordinates is as follows:<br>> > ><br>> > > x = T*M*x' where "T" is ResliceTransform and "M" is ResliceMatrix<br>> > ><br>> > > So this tells you that, if "M" is chosen to be a pure rotation<br>> > > matrix,<br>> > > and if "T" contains the position of the tool point in input image<br>> > > coordinates, then the point x' = (0,0,0), which is in the centre<br>> > > of our<br>> > > output plane, will correspond to the point x =
tool_point. So, we<br>> > > will<br>> > > be extracting a slice through the tool point position.<br>> > ><br>> > > I know that is probably not the best description, let me know if<br>> > > things<br>> > > aren't quite clear.<br>> > ><br>> > > - David<br>> > ><br>> > ><br>> > ><br>> > ><br>> > > Emmanouil Moschidis wrote:<br>> > > > Hello<br>> > > ><br>> > > > I want to use the vtkImageReslice class for reading a series of<br>> > > slices<br>> > > > and exctracting one slice based on coordinates and quaternions<br>> > > > received from a tracking system.<br>> > > ><br>> > > > Is there any specific documentation and/or any working<br>> > examples for<br>> > > >
this class? It is very powerful yet the only usable information<br>> > > I have<br>> > > > found is the class reference webpage.<br>> > > ><br>> > > > Any hint about how to proceed towards the insight of it would be<br>> > > > highly appreciated<br>> > > ><br>> > > > thanks<br>> > > ><br>> > > ><br>> > ><br>> ><br>> ------------------------------------------------------------------------<br>> > > > Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge<br>> > > > to<br>> > > > see what's on, when.<br>> > > ><br>> > ><br>> ><br>> ------------------------------------------------------------------------<br>> > > ><br>> > > > _______________________________________________<br>>
> > > This is the private VTK discussion list.<br>> > > > Please keep messages on-topic. Check the FAQ at:<br>> > > http://www.vtk.org/Wiki/VTK_FAQ<br>> > > > Follow this link to subscribe/unsubscribe:<br>> > > > http://www.vtk.org/mailman/listinfo/vtkusers<br>> > > ><br>> > ><br>> > ><br>> > ><br>> ><br>> ------------------------------------------------------------------------<br>> > > Be a PS3 game guru.<br>> > > Get your game face on with the latest PS3 news and previews at<br>> > Yahoo!<br>> > > Games.<br>> ><br>> ><br>> ><br>> ------------------------------------------------------------------------<br>> > Yahoo! oneSearch: Finally, mobile search that gives answers<br>> > ,<br>> > not web
links.<br>><br>><br>> ------------------------------------------------------------------------<br>> Luggage? GPS? Comic books?<br>> Check out fitting gifts for grads <br>> <http: us.rd.yahoo.com="" evt="48249/*http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz"> <br>> at Yahoo! Search. <br><br></http:></dgobbi@atamai.com></blockquote><br><p> 
<hr size=1>Take the Internet to Go: Yahoo!Go puts the <a href="http://us.rd.yahoo.com/evt=48253/*http://mobile.yahoo.com/go?refer=1GNXIC">Internet in your pocket:</a> mail, news, photos & more.