No DICOM magic number found, but the file appears to be DICOM without a preamble.
Proceeding without caution.No DICOM magic number found, but the file appears to be DICOM without a preamble.
Proceeding without caution.
solution:
use dcmread force=True, and
`def load_dcm_images_from_path(dicom_series_path: str) -> List[Dataset]:
seriesdata = []
for root, , files in os.walk(dicom_series_path):
for file in files:
try:
ds = dcmread(os.path.join(root, file), force=True)
if hasattr(ds, 'PixelData'):
series_data.append(ds)
except Exception:
# Not a valid DICOM file
continue
return series_data`
and delete the validation function
` def create_from(dicom_series_path: str, rt_struct_path: str) -> RTStruct:
"""
Method to load an existing rt struct, given related DICOM series and existing rt struct
"""
series_data = image_helper.load_sorted_image_series(dicom_series_path)
ds = dcmread(rt_struct_path)
# RTStructBuilder.validate_rtstruct(ds)
# RTStructBuilder.validate_rtstruct_series_references(ds, series_data)
# TODO create new frame of reference? Right now we assume the last frame of reference created is suitable
return RTStruct(series_data, ds)`
No DICOM magic number found, but the file appears to be DICOM without a preamble. Proceeding without caution.No DICOM magic number found, but the file appears to be DICOM without a preamble. Proceeding without caution.
solution: use dcmread force=True, and `def load_dcm_images_from_path(dicom_series_path: str) -> List[Dataset]: seriesdata = [] for root, , files in os.walk(dicom_series_path): for file in files: try: ds = dcmread(os.path.join(root, file), force=True) if hasattr(ds, 'PixelData'): series_data.append(ds)
and delete the validation function ` def create_from(dicom_series_path: str, rt_struct_path: str) -> RTStruct: """ Method to load an existing rt struct, given related DICOM series and existing rt struct """