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

Problem writing x-ray angiography data (2D+ time) #200

Open
ChristianEschen opened this issue Sep 22, 2022 · 2 comments
Open

Problem writing x-ray angiography data (2D+ time) #200

ChristianEschen opened this issue Sep 22, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@ChristianEschen
Copy link

Hi.

I try to use the software to write a DICOM SEG file for x-ray angiography images (2D+time).

The files can be found here:
http://www.rubomedical.com/dicom_files/dicom_viewer_0002.zip

However, I get the following error:
##########################
Exception has occurred: ValueError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
Only a single frame is supported when the source image has no Frame of Reference UID.
#########################

I use the hidicom installed from source.

The code I use is the following:
`from pathlib import Path

import highdicom as hd
import numpy as np
from pydicom.sr.codedict import codes
from pydicom.filereader import dcmread

series_path = "/home/alatar/miacag/data/angio/sample_data/2/0002.dcm"

Read XA angiography data

image_dataset = dcmread(series_path)

Create a binary segmentation mask

mask = np.zeros(
shape=(
image_dataset.pixel_array.shape[0],
image_dataset.Rows,
image_dataset.Columns
),
dtype=np.bool
)
mask[0:20, 0:20,0:20] = 1

Describe the algorithm that created the segmentation

algorithm_identification = hd.AlgorithmIdentificationSequence(
name='test',
version='v1.0',
family=codes.cid7162.ArtificialIntelligence
)

Describe the segment

description_segment_1 = hd.seg.SegmentDescription(
segment_number=1,
segment_label='first segment',
segmented_property_category=codes.cid7150.Tissue,
segmented_property_type=codes.cid7166.ConnectiveTissue,
algorithm_type=hd.seg.SegmentAlgorithmTypeValues.AUTOMATIC,
algorithm_identification=algorithm_identification,
tracking_uid=hd.UID(),
tracking_id='test segmentation of slide microscopy image'
)

Create the Segmentation instance

seg_dataset = hd.seg.Segmentation(
source_images=[image_dataset],
pixel_array=mask,
segmentation_type=hd.seg.SegmentationTypeValues.BINARY,
segment_descriptions=[description_segment_1],
series_instance_uid=hd.UID(),
series_number=2,
sop_instance_uid=hd.UID(),
instance_number=1,
manufacturer='Manufacturer',
manufacturer_model_name='Model',
software_versions='v1',
device_serial_number='Device XYZ'
)

print(seg_dataset)
seg_dataset.save_as("/home/alatar/seg.dcm")
`

I hope you can help me out.

@CPBridge
Copy link
Collaborator

Hi @ChristianEschen, thanks for using the library and reporting this issue.

Unfortunately, what you are reporting is currently the expected behaviour of the library in this situation, i.e. an error message that what you are trying to do is not supported. There are a very large number of possible DICOM objects for which users may wish to create segmentations, which often require tailored methods to index the frames in the created segmentation in order to be compliant to the standard, and supporting many of them is therefore a considerable challenge. We have tried to support those inputs that we think are most likely to be useful, and unfortunately we have not yet implemented a solution for the 2D + T angiography case (or indeed any input image or series with multiple frames and no frame of reference UID to describe the frames in 3D space).

I hope that we will be able to support this at some point, although I have to say that it is unlikely to be soon I'm afraid. Your example file will be very helpful to us for this purpose so we do appreciate you filing the issue. I will leave this issue open.

A note for when we work on this: we will need to create a new indexing scheme based on the FrameTime attribute, which gives the time in ms between consecutive frames.

@CPBridge CPBridge self-assigned this Sep 23, 2022
@CPBridge CPBridge added the enhancement New feature or request label Sep 23, 2022
@CPBridge
Copy link
Collaborator

Note that #174 is a related issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants