We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4cde694 commit ff84658Copy full SHA for ff84658
python/main.py
@@ -464,12 +464,12 @@ async def get_files(files: list[UploadFile]) -> UploadFilesResponse:
464
with fp.open("wb") as f:
465
f.write(contents)
466
try:
467
- pydicom.dcmread(fp)
468
- proper_dicom_paths.append(fp)
469
- total_uploaded_file_bytes += len(contents)
+ dcm = pydicom.dcmread(fp)
+ if len(dcm.pixel_array.shape) == 2: # noqa: PLR2004
+ proper_dicom_paths.append(fp)
470
+ total_uploaded_file_bytes += len(contents)
471
except InvalidDicomError:
- inv_fp = Path(fp)
472
- inv_fp.unlink()
+ pass
473
total_uploaded_file_megabytes = "%.1f" % (total_uploaded_file_bytes / (10**3) ** 2)
474
return UploadFilesResponse(
475
n_uploaded_files=len(proper_dicom_paths),
0 commit comments