Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DICOM: use FrameTimePointer to detect timelapse data #4196

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

melissalinkert
Copy link
Member

This is a potential replacement for #4167. As recommended in #4167 (comment), this uses the presence of a valid FrameTimePointer to determine if SizeT should be set instead of SizeZ.

This changes the behavior of a few existing sample files, so a configuration PR is forthcoming.

Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is likely a question of how far we want to push this initial timelapse support in DICOM.

I agree with #4167 (comment) as a good starting point i.e. update the reader to support the CineModule and check for Frame Increment Pointer tags pointing either to Frame Time or Frame Time Vector.

As shown by the repository tests and the required configuration changes, we seem to have a few sample images including public sample images with multiple time frames e.g.
US-MONO2-8-8x-execho.dcm, NM-MONO2-16-13x-heart.dcm or MR-MONO2-8-16x-heart.dcm. I'll review the samples linked from #4167 (comment) to see if there are other representative public samples that should be added to the curated QA repository.

A couple of inline questions. Possibly the most critical engineering decision is whether we want to also store the time offset directly under DicomTile. This is a bigger change and would probably end up as a requirement in the case where we want to support DICOM files with multiple timepoints and focal planes.

@@ -689,6 +717,23 @@ else if (child.attribute == OPTICAL_PATH_DESCRIPTION) {
}
if (imagesPerFile == 0) imagesPerFile = 1;

// pointer could be FrameTime or FrameTimeVector, or possibly something else?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these two tags are defined in

and

should we make this logic defensive and check the tag attribute before setting frameTime?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking here was to not assume that the pointer would necessarily be FRAME_TIME or FRAME_TIME_VECTOR. For NM data in particular, I think that assumption would not hold (see https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.8.4.8.html#sect_C.8.4.8.1.1), but could also imagine a file that has FrameIncrementPointer pointing to a private tag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely agreed that the reader should not assume the tag will reference one of these two tags or even official tags.

Maybe my question was more specifically about how we would handle both scenarios:

  • if Frame Increment Pointer points to Frame Time or Frame Time Vector then the logic should be updated as proposed here to detect the image as multi-T and optionally set the time metadata appropriately
  • if Frame Increment Pointer points to another tag (or multiple tags), should the current reader logic be preserved i.e. use the Z dimension to aggregate the frames? Or would we still switch to using the T dimension similarly to what MinimalTiffReader does for multi-page TIFF without additional metadata?

int timepoint = coords[2];
if (isTimelapse()) {
z = coords[2];
timepoint = coords[1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this inversion is related to the fact that the frame offsets are currently stored as DicomTile.zOffset.

Do you have a feeling about the cost vs value of updating DicomTile to also store tOffset instead?


for (DicomTag t : tags) {
if (frameIncrementPointer.equals(t.attribute)) {
frameTime = t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two possible metadata follow-ups

  • FrameTime could likely be mapped into Pixels.TimeIncrement
  • FrameTimeVector could be mapped into Plane.DeltaT

@dgault dgault added this to the 8.0.0 milestone Jul 8, 2024
@snoopycrimecop
Copy link
Member

Conflicting PR. Removed from build BIOFORMATS-push#161. See the console output for more details.
Possible conflicts:

--conflicts

@dgault
Copy link
Member

dgault commented Aug 12, 2024

Some test failures that look to be due to this being excluded: https://merge-ci.openmicroscopy.org/jenkins/job/BIOFORMATS-test-folder/lastFailedBuild/consoleFull

Excluding the config PR temporarily until this is back in the merge build will likely be enough to resolve the failures

@snoopycrimecop
Copy link
Member

Conflicting PR. Removed from build BIOFORMATS-push#164. See the console output for more details.
Possible conflicts:

--conflicts

@snoopycrimecop
Copy link
Member

Conflicting PR. Removed from build BIOFORMATS-push#165. See the console output for more details.
Possible conflicts:

--conflicts

@melissalinkert melissalinkert removed this from the 8.0.0 milestone Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants