Skip to content

Commit

Permalink
feat(metadata): added check for csv type on imgFileListPath argument
Browse files Browse the repository at this point in the history
  • Loading branch information
strixy16 committed Dec 20, 2023
1 parent 57768cf commit ac09625
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/yarea/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def matchCTtoSegmentation(imgFileListPath: str,
if segType != "RTSTRUCT" and segType != "SEG":
raise ValueError("Incorrect segmentation file type. Must be RTSTRUCT or SEG.")

# Check that imgFileListPath is a csv file to properly be loaded in
if not imgFileListPath.endswith('.csv'):
raise ValueError("This function expects to load in a .csv file, so imgFileListPath must end in .csv")

# Load in complete list of patient image directories of all modalities (output from med-imagetools crawl)
fullDicomList = pd.read_csv(imgFileListPath, index_col=0)

Expand Down Expand Up @@ -103,6 +107,10 @@ def getSegmentationType(imgFileListPath: str):
str
Segmentation type (RTSTRUCT or SEG)
"""
# Check that imgFileListPath is a csv file to properly be loaded in
if not imgFileListPath.endswith('.csv'):
raise ValueError("This function expects to load in a .csv file, so imgFileListPath must end in .csv")

# Load in complete list of patient image directories of all modalities (output from med-imagetools crawl)
fullDicomList = pd.read_csv(imgFileListPath, index_col=0)

Expand Down

0 comments on commit ac09625

Please sign in to comment.