Skip to content

Commit

Permalink
Merge pull request #452 from zivy/updateQACode
Browse files Browse the repository at this point in the history
Update qa code
  • Loading branch information
zivy authored Sep 5, 2024
2 parents 06ef2b9 + fda0210 commit 69d38da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Python/71_Trust_But_Verify.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"import SimpleITK as sitk\n",
"import pandas as pd\n",
"import numpy as np\n",
"import ast\n",
"import os\n",
"import sys\n",
"import shutil\n",
Expand Down Expand Up @@ -735,7 +736,10 @@
"outputs": [],
"source": [
"faux_volume_image_files = sitk.ReadImage(faux_series_volume_file_name)\n",
"image_file_list = pd.read_csv(faux_series_file_list_name)[\"files\"].apply(eval).to_list()\n",
"# convert string representation of list of file names to a list of file names\n",
"image_file_list = (\n",
" pd.read_csv(faux_series_file_list_name)[\"files\"].apply(ast.literal_eval).tolist()\n",
")\n",
"\n",
"image_selection_gui2 = ImageSelection(\n",
" faux_volume_image_files,\n",
Expand Down
8 changes: 8 additions & 0 deletions Python/scripts/characterize_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,11 @@ def characterize_data(argv=None):
nargs="*",
help="titles of the results columns for the metadata_keys",
)
parser.add_argument(
"--ignore_problems",
action="store_true",
help="problematic files will not be listed if parameter is given on commandline",
)

args = parser.parse_args(argv)
if len(args.external_applications) != len(args.external_applications_headings):
Expand Down Expand Up @@ -479,6 +484,9 @@ def characterize_data(argv=None):
meta_data_keys=args.metadata_keys,
additional_column_names=args.metadata_keys_headings,
)
# remove all rows associated with problematic files (non-image files or image files with problems)
if args.ignore_problems:
df.dropna(inplace=True)
# save the raw information, create directory structure if it doesn't exist
os.makedirs(os.path.dirname(args.output_file), exist_ok=True)
df.to_csv(args.output_file, index=False)
Expand Down

0 comments on commit 69d38da

Please sign in to comment.