Open judy-shang opened 3 weeks ago
Hi @judy-shang, thanks for raising the issue. It seems like the ROI files you are trying to open are not DICOM. If you are using Hepatogram Plus, the output data should be in DICOM. What is the data you are trying to run on?
Hi kkalutkiewicz, Thanks for you sharing, it helps a lot. There's a bug of the code, ROI file is bytes array and can not read by pydicom, the source code and trace is as below:
Traceback (most recent call last): File "D:\xxx\3dmre_stats-main\mmdi3d_utils.py", line 505, in
measure_mmdi3d_contrasts_in_rois(acl_path, temp_dir, inversion_3d_dir, exclude_negative_pixels)
File "D:\xxx\3dmre_stats-main\mmdi3d_utils.py", line 496, in measure_mmdi3d_contrasts_in_rois
contrast_data=apply_rois_to_mmdi3d_contrasts(slice_data,exclude_negative_pixels,logger)
File "D:\xxx\3dmre_stats-main\mmdi3d_utils.py", line 456, in apply_rois_to_mmdi3d_contrasts
roi_stack=read_images(roi_paths)
File "D:\xxx\3dmre_stats-main\dicom_and_file_utils.py", line 197, in read_images
ds = pydicom.read_file(slice)
File "D:\Software\Python312\Lib\site-packages\pydicom\filereader.py", line 1030, in dcmread
dataset = read_partial(
File "D:\Software\Python312\Lib\site-packages\pydicom\filereader.py", line 778, in read_partial
preamble = read_preamble(fileobj, force)
File "D:\Software\Python312\Lib\site-packages\pydicom\filereader.py", line 723, in read_preamble
raise InvalidDicomError(
pydicom.errors.InvalidDicomError: File is missing DICOM File Meta Information header or the 'DICM' prefix is missing from the header. Use force=True to force reading.