Reverse search volume in sequence volume and get frame number

Hi,

I got an extracted frame (volume) from a sequence and I would not like to go back and figure out which frame it originally was. Is there a way to search a sequence for a given volume and extract the original frame number?

Szenario A (creation):

  1. user loads a sequence into 3D Slicer
  2. user extracts frame
  3. user saves MRML scene
  4. repeat 1-3 on hundreds of datasets

Szenario B (reverse search):

  1. user loads MRML scene
  2. user puts sequence and extracted frame next to each other and compares frame by frame visually

I would want to automate Szenario B somehow. Is this possible?

Best,
Christian

This looks very similar to what is implemented in the utrasound annotation export module, which generates training data for deep-learning-based segmentation. Probably the same method can be used to link extracted frames to the original frames.

The module might be usable in your workflow as is, or with small modifications.

@ungi

Yes. Look at how the SingleSliceSegmentation module in the link Andras provided. It hides the original frame number in the segmentation as a MRML node attribute. However, if you just want to compare the segmentation with the original image, there is a more convenient method that does not require a custom module. You can create another sequence and save there both the segmentation and the original image. That will be a copy, so that is not super storage efficient. But it works in Slicer as is.

Thanks for the replies.

I think, it’s a bit more complicated when I go back to old mrmlScenes where I only have the original sequence and an extracted frame as a scalar volume.

Basically, I want to look at those old cases where I don’t have any information saved anywhere about which frame was extracted.

I think another way would be to use Subtract Scalar Volumes with 0 interpolation iterating over every frame of the Sequence subtracting the scalar volume I am looking for.

The resulting volume would (if it is the frame we are looking for) have only pixel values 0.

This wouldn’t work though if the scalar volume was modified after extraction.

You can compute histogram of the difference and if most of the voxels have no or small difference then most likely the volumes match.

1 Like