DICOM SEG for CMR cine data (2D + t)
See original GitHub issueTrying to generate a dicom seg file based on a multiple unsigned np.array, which is of shape (#_frames, #rows, #cols). The way I’ve approached the task was by generating dicom seg with the same series uid across all frames of the segmentation array. However, when displaying the output the 3 different delineated structures do not appear on a single frame (spatially they do not overlap).
Bellow is an example of the code that I’ve used to generate the dicom outputs.
Is it possible to show all the 3 structures in a single frame?
# img_dsets (list): list of pydicom.Datasets with lenght equal to the number of short-axis cine data
# seg_vol (np.array): Segmentation volume array with shape (#_frames, #rows, #cols)
import pydicom as pyd
import highdicom as hd
manufacturer_name = "dummy_manufacturer_name"
manufacturer_model_name = "dummy_model_name"
software_version = "0.1"
seg_labels = {
"myocardium": {"class_number": 1, "sct_code": pyd.sr.codedict.codes.SCT.LeftVentricleMyocardium},
"left_ventricle": {"class_number": 3, "sct_code": pyd.sr.codedict.codes.SCT.LeftVentricle},
"right_ventricle": {"class_number": 2, "sct_code": pyd.sr.codedict.codes.SCT.RightVentricle},
}
algo_details = hd.AlgorithmIdentificationSequence(
name=manufacturer_model_name,
version=software_version,
family=pyd.sr.codedict.codes.cid7162.ArtificialIntelligence,
source=manufacturer_name,
)
segment_descriptions = []
for label_name, label_info in seg_labels.items():
seg_details = hd.seg.SegmentDescription(
segment_number=label_info["class_number"],
segment_label=label_name,
segmented_property_category=pyd.sr.codedict.codes.cid7150.AnatomicalStructure,
segmented_property_type=label_info["sct_code"],
algorithm_type=hd.seg.SegmentAlgorithmTypeValues.AUTOMATIC,
algorithm_identification=algo_details,
tracking_uid=hd.UID(),
tracking_id=f"Cardiac structure #{class_number}",
)
segment_descriptions.append(seg_details)
series_uid = hd.UID()
for frame_idx in range(seg_vol.shape[0]):
seg_dset = hd.seg.Segmentation(
source_images=[img_dsets[frame_idx]],
pixel_array=seg_vol[frame_idx],
segmentation_type=hd.seg.enum.SegmentationTypeValues.BINARY,
segment_descriptions=segment_descriptions,
series_description="Segmentation-Test",
series_number=5,
series_instance_uid=series_uid,
sop_instance_uid=hd.UID(),
instance_number=int(frame_idx) + 1,
manufacturer=manufacturer,
manufacturer_model_name=manufacturer_model_name,
software_versions=software_version,
device_serial_number=str(img_dsets[frame_idx].DeviceSerialNumber),
)
seg_dsets.append(seg_dset)
Also, I’ve tried to generate a single dataset file for all frames at once, and with that approach the output data only shows a total number of frames equal to the # of classes, not iterating over all the frames.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
CMRSegTools: An open-source software enabling ... - NCBI
CMRSegTools : An open-source software enabling reproducible research in segmentation of acute myocardial infarct in CMR images.
Read more >A data‐driven semantic segmentation model for direct ...
This approach can jointly accelerate time-consuming cine image acquisition and cumbersome manual image analysis. 1 INTRODUCTION. Cardiovascular ...
Read more >Segment CMR Instructions For Use - English US version
DICOM -format using multi-slice, multi-frame and velocity encoded MR im- ages. Segment CMR provides features for analysis of cardiac function ...
Read more >chfc-cmi/cmr-seg-tl: Companion repository for "Knowledge ...
This project aims to provide guidelines, code and data for researchers and clinicians who want to train their own cardiac MR segmentation network....
Read more >CMRSegTools: An open-source software enabling ...
CMRSegTools allows the creation of training and testing data sets ... T2, T2*, Cine and 3D/2D Late Gadolinium Enhancement (LGE) scans.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the help! Think an image might be better to describe what was I referring to. The goal was to obtain something like figure bellow, for each frame (viewer: 3D Slicer)
Currently, with the above code, the output does not show the 3 regions in the same plane and does not contain all the information of the patient along the frames dimension.
I will explore the get_pixels_by_dimension_index_values(), to verify if the label map is generated accordingly.
Also, I’ve tried to use
get_pixels_by_dimension_index_values
but I’m having some troubles with the argumentdimension_index_values
. Dont’ know how to define it properly.