diff --git a/platipy/cli/tcia_download.py b/platipy/cli/tcia_download.py index 6ed734f1..b53f09af 100644 --- a/platipy/cli/tcia_download.py +++ b/platipy/cli/tcia_download.py @@ -15,11 +15,10 @@ # limitations under the License. import sys +import logging import click -import logging -logger = logging.getLogger(__name__) from platipy.dicom.download.tcia import ( get_collections, @@ -28,6 +27,7 @@ fetch_data, ) +logger = logging.getLogger(__name__) logger.remove() logger.add(sys.stderr, level="DEBUG") diff --git a/platipy/dicom/io/nifti_to_rtstruct.py b/platipy/dicom/io/nifti_to_rtstruct.py index efae383f..c87375fc 100644 --- a/platipy/dicom/io/nifti_to_rtstruct.py +++ b/platipy/dicom/io/nifti_to_rtstruct.py @@ -19,11 +19,12 @@ import SimpleITK as sitk import numpy as np import logging -logger = logging.getLogger(__name__) from matplotlib import cm from rt_utils import RTStructBuilder +logger = logging.getLogger(__name__) + def convert_nifti(dcm_path, mask_input, output_file, color_map=cm.get_cmap("rainbow")): """Convert a set of masks to a DICOM RTStruct object. diff --git a/platipy/imaging/dose/dvh.py b/platipy/imaging/dose/dvh.py index dfd733e3..8b397879 100644 --- a/platipy/imaging/dose/dvh.py +++ b/platipy/imaging/dose/dvh.py @@ -49,8 +49,8 @@ def calculate_dvh(dose_grid, label, bins=1001): values = np.cumsum(counts[::-1])[::-1] if np.all(values == 0): return bins, values - else: - values = values / values.max() + + values = values / values.max() return bins, values @@ -106,7 +106,7 @@ def calculate_dvh_for_labels(dose_grid, labels, bin_width=0.1, max_dose=None): "cc": cc, "mean": mean_dose, }, - **{d: c for d, c in zip(bins, values)}, + **dict(zip(bins, values)), } dvh.append(entry) diff --git a/platipy/imaging/projects/cardiac/service.py b/platipy/imaging/projects/cardiac/service.py index c80a68d5..f4f458b2 100644 --- a/platipy/imaging/projects/cardiac/service.py +++ b/platipy/imaging/projects/cardiac/service.py @@ -17,6 +17,7 @@ import SimpleITK as sitk import logging + logger = logging.getLogger(__name__) # import pydicom @@ -42,7 +43,7 @@ def cardiac_service(data_objects, working_dir, settings): output_objects = [] for data_object in data_objects: - logger.info("Running on data object: " + data_object.path) + logger.info("Running on data object: %s", data_object.path) # Read the image series load_path = data_object.path @@ -110,7 +111,8 @@ def cardiac_structure_guided_service(data_objects, working_dir, settings): if len(data_object.children) == 0: logger.error( "Wholeheart structure needed for structure guided cardiac " - "segmentation, skipping %s", data_object.id + "segmentation, skipping %s", + data_object.id, ) continue diff --git a/platipy/imaging/projects/nnunet/run.py b/platipy/imaging/projects/nnunet/run.py index dec54186..9044fe56 100644 --- a/platipy/imaging/projects/nnunet/run.py +++ b/platipy/imaging/projects/nnunet/run.py @@ -1,6 +1,7 @@ import os import tempfile +import shutil import urllib.request from pathlib import Path import logging