after rotate the reslicecursor, how to get the slice count?

I use these classes to display MPR.when I rotate the reslicecursor with the mouse, we can the see the reslicecursor rotate and the slice changed with the rotation. at this status, if I move the rotated cursor, the slice will changed. but how can I get the slices count after rotating?

In oblique slices, each pixel has a different slice number, so you need to look up for each physical (L, P, S) position what is the corresponding voxel (I, J, K) position. Typically slice number is value of K coordinate + 1,

1 Like

Can you describe this method in detail? or give me some code? thanks a lot.

These might help in understanding how to convert between physical (LPS, RAS, …) and voxel (IJK) coordinate system:

1 Like

thanks, I have some idea about reslice.

I want to display my slice number in each surface as you showed with green label.
I displayed my 2d slices with vtkResliceWidget.
Can you help me with that?

For oblique slices, there are no slice numbers because one oblique slice is constructed from hundreds of original slices. You can display something like distance from origin (this is what we do in 3D Slicer), but it’s not that useful. Or you can display slice number at the current slice position, again, not that useful, because you cannot match it to the content displayed on slice-based 2D viewers.

I only display sagittal coronal and axial not oblique.
And wants to get current displayed slice number.
As I saw there is only spacing , origin and extend data we can have from input data.
How can i do according to your reply?

VTK does not keep track of original DICOM slice numbers. If you want to make sure you display the correct value then you need to read slice number and image position&orientation for each slice from the original DICOM image and use these information to look up the values. There are no DICOM slice numbers for reformatted (sagittal, coronal) slices. You may use voxel (IJK) coordinates as surrogates - it will give the user a general idea about how many slices are there along that specific axis and which one is the current slice (but this cannot be used to cross-reference with another viewer, because the choice of axis directions are arbitrary).

I didn’t understand well.
I have to change my viewer or use voxels(if yes how)?

Showing slice number or IJK coordinate in a view is not related to how you render the image. You can determine IJK coordinate from IJKToLPS transform and LPS position of the current slice.

If you want to be able to develop a medical image viewer then you probably need to do a lot more independent study (e.g., read VTK Textbook and ITK Software Guide a few times, study VTK examples and source code of open-source medical image viewers, such as 3D Slicer and MITK). If you just want to develop a system or an application that can import and visualize and edit medical images, segmentations, models, etc. so that you can add your own science/algorithms/ideas to it, then there is no need to spend time with redeveloping everything from scratch but you can build on existing open-source platforms.