Skip to content

Commit

Permalink
Refactor: generateFilePathFromDICOMAttributes method
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Jan 28, 2024
1 parent f8aaa61 commit d1a437e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/nbiatoolkit/dicomsort/dicomsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from typing import Optional


class DICOMSorter:
def __init__(
self,
Expand All @@ -25,9 +26,7 @@ def __init__(
self.truncateUID = truncateUID
self.sanitizeFilename = sanitizeFilename

def generateFilePathFromDICOMAttributes(
self, dataset: pydicom.FileDataset
) -> str:
def generateFilePathFromDICOMAttributes(self, dataset: pydicom.FileDataset) -> str:
"""
Generate a file path for the DICOM file by formatting DICOM attributes.
"""
Expand Down Expand Up @@ -58,8 +57,9 @@ def sortSingleDICOMFile(
assert option in ["copy", "move"], "Invalid option: symlink not implemented yet"

try:

dataset : pydicom.FileDataset = pydicom.dcmread(filePath, stop_before_pixels=True)
dataset: pydicom.FileDataset = pydicom.dcmread(
filePath, stop_before_pixels=True
)
except InvalidDicomError as e:
print(f"Error reading file {filePath}: {e}")
return False
Expand Down

0 comments on commit d1a437e

Please sign in to comment.