Extract RAS coordinates from reformated slice

Hi all,

I want to extract RAS coordinates from a reformated slice.

I built a cilinder with an offset on the axial view, so I create the segment you can see in the figure below.

With Extract Centerline module I generate the centerline and get the perpendicular plane we can see in the red slice. It would be very useful if I can get at a time all RAS coordinates from the whole slice and their pixel values, how can I do that?

Thanks ^^

Each voxel have a different RAS coordinates. There should be no need to extract each. Any pixel-by-pixel processing would be unbearably slow.

You can get voxel values by using vtkImageReslice filter. Each slice view already has a reslice filter, so you may just use that instead of setting one up yourself.

What is your overall goal?

Our goal is to segment a structure using perpendicular planes.

Imaging we have the cilinder in the post above. The axial planes correspond with the elipses, but we only know how to segment in the perpendicular view (circles).

The workflow is:

1. Load volume
2. Make a rough segmentation of the cilinder and generate a centerline
3. Obtain perpendicular planes in each point of the centerline (in a real case we have different orientations, the cilinder can be a vessel, for example)
4. Export the reformat slices as images 
5. Segment the images and obtain binary masks (outside Slicer)
6. Use this masks to rebuild the segment volume (cilinder) in Slicer.

We are having some issues with steps 4, since we do not know the optimal way to obtain voxel values of one slice in an optimal way, and 6, since we need to know pixel coordinates of the perpendicular view to paint the original volume (in slicer) using the generated masks in step 4.


You’ll see that Slicer is pretty amazing. All the steps that you need to do are already implemented and it is all very fast and accurate.

  • Step 2 is implemented in Extract centerline module in VMTK extension.
  • Step 3-4 és called curved planar reformatting and it is implemented in Curved Planar Reformat module in Sandbox extension. You just specify the image, centerline, resolution, slice size and the module provides you all the reformatted slices in a 3D array ('Straightened volume). It is all very accurate and efficient. Moreover, it also provides the Straightening transform`, which can translate any 3D object (image, segmentation, centerline, landmark points, etc.) between the original image space and the straightened space.
  • You can save the 3D volume, process it slice by slice (segment the vessel lumen, segment/characterize plaque, etc) and then save the result in a 3D volume that had the same geometry (origin, spacing, axis directions) as the input volume.
  • Step 6 - volume reconstruction is implemented in Slicer, too. If the centerline resolution and slice size is chosen that slices do not intersect then you can reconstruct the segmentation by simply inverting the straightening transform, apply it to the straightened image segmentation, and harden the transform (each of these steps are just a few clicks). In case your centerline is highly curved or you need very high resolution along the centerline then the extracted slices may intersect each other. In this case, you can use use Volume Reconstruction module in SlicerIGT extension, as this module can reconstruct volumes from arbitrarily moving, intersecting slices. The input of this module is a time series of properly positioned and oriented slices, so if you want to use this module then you need to copy each oriented slice into a volume sequence.

That’s exactly what we needed! Slicer continues surprising us :slight_smile:


Hi Andras, we are very pleasent with the results of the straightening module, but now we want to use it to straight our own segmentations and mask over it, and we found some issues. Our process is basically:

  1. Upload the segmentation.

  2. Extract centerlines.

  3. Use Curved Planar Reformat to straight the volumen around the centerline.

  4. Use straightening Transform to straight the segmentation. We straight all the segmentation but we are interested only in a specific region (Around the straight Volume we made before).

  5. Create a mask from the straightened segmentation we made.

  6. Use this mask for our porpouses (out of Slicer).

The problem arises when we try to generate the mask, because it’s not well made. To do this mask we use two methods:

  1. Mask Volume tool: If we use the Mask Volume on our straight segment, the tool generates a non-accurate mask.

  2. LabelMap: In the Data module we can make a binary labelmap from the straightened segmentation. The results here are pretty good (see image below), but the problem is the fact that the segment its bigger than the straight volume. To reduce the labelmap to the straight volume, we use the Crop Volume module, but the interpolation made on the ROI gets a worse mask, losing information and making it a non valid way to masking.

If any of the steps are not enough clear, please tell us.

Thanks ^^

You can increase the image resolution if you find that the interpolation artifacts are non-negligible. For example, you can set Spacing scale to 0.5 or 0.25 in Crop volume module.

Hi Andras, with those methods related on the previous comment we didn´t achieve any results… If we focus on the first one:

  1. When we straight the volume around one centerline, we also use the straightening transform to straight the model of the segmentation that we have.
  2. In this procedure, the model becomes straight over the centerline and the rest is usually distorted.
  3. Then, we use this model to create a new segmentation (if we don’t do this proccess segmentation → model → segmentation, the results are even worse). In this segmentation we obtain the volume using the tool Mask Volume from Segment Editor module.
  4. The mask is used out of slicer.

With this method, which we consider is more solid and useful, we found some technical issues:

• The quality of the segmentation made from the model is poor (see image below) on critical zones.

Blue: straighten model
Pink: straighten segment obtained by converting the model to a segment

Although this zone is bad reconstructed, the “easy” zones are well reconstructed (see image below). However, we need to be very precise in all the segmentation.

Blue: straighten model
Pink: straighten segment obtained by converting the model to a segment

What we expected is that all pixel inside the blue model would be part of the pink segmentation, but it is not the case.

• Also, we want to know if is possible, starting from a segmentation we have, select only the part that corresponds to a specific centerline and work with this cut-out instead with the original segmentation.

Finally, one more question: Slicer is awesome when it works with geometries ([x,y,z] world), because we can clearly straight a geometry and nothing bad happens, but is slicer able to, given a volume (made of mask images), come through the transform an recover the original segmentation with enough quality?
We lose information becoming from the model to the segmentation.

That´s all, we hope the procedure is clearly enough.

Thanks a lot :slight_smile: .