Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuegler committed Jun 20, 2024
1 parent 37de053 commit 706cb46
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion HypVINN/data_loader/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def transform_axial2sagittal(vol: np.ndarray, axial2sagittal: bool = True) -> np
----------
vol : np.ndarray
The image volume to transform.
axial2sagittal : bool, optional
axial2sagittal : bool, default=True
A flag to determine the direction of the transformation. If True, transform from axial to sagittal. If False,
transform from sagittal to axial. (Default: True).
Expand Down
2 changes: 1 addition & 1 deletion HypVINN/data_loader/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(
The original zoom of the subject.
cfg : CfgNode
The configuration object.
mode : ModalityMode, optional
mode : ModalityMode, default="t1t2"
The running mode of the HypVINN model. (Default: "t1t2").
transforms : Callable, optional
The transformations to apply to the images. (Default: None).
Expand Down
2 changes: 1 addition & 1 deletion HypVINN/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def run(
The tensor to update with the prediction probabilities.
out_res : float, optional
The resolution of the output. Default is None.
mode : ModalityMode, optional
mode : ModalityMode, default="t1t2"
The mode of the modalities. Default is 't1t2'.
Returns
Expand Down
34 changes: 17 additions & 17 deletions HypVINN/run_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ def optional_path(a: Path | str) -> Optional[Path]:
Parameters
----------
a : Path | str
a : Path, str
The input to convert.
Returns
-------
Optional[Path]
Path, optional
The converted Path object.
"""
f"""
if isinstance(a, Path):
return a
if a.lower() in ("none", ""):
Expand Down Expand Up @@ -190,9 +190,9 @@ def main(
----------
out_dir : Path
The output directory where the results will be stored.
t2 : Optional[Path]
t2 : Path, optional
The path to the T2 image to process.
orig_name : Optional[Path]
orig_name : Path, optional
The original name of the input image.
sid : str
The subject ID.
Expand All @@ -208,23 +208,23 @@ def main(
The path to the coronal configuration file.
cfg_sag : Path
The path to the sagittal configuration file.
hypo_segfile : str, optional
hypo_segfile : str, default="{HYPVINN_SEG_NAME}"
The name of the hypothalamus segmentation file. Default is HYPVINN_SEG_NAME.
allow_root : bool, optional
allow_root : bool, default=False
Whether to allow running as root user. Default is False.
qc_snapshots : bool, optional
Whether to create QC snapshots. Default is False.
reg_mode : Literal["coreg", "robust", "none"], optional
reg_mode : "coreg", "robust", "none", default="coreg"
The registration mode to use. Default is "coreg".
threads : int, optional
threads : int, default=-1
The number of threads to use. Default is -1, which uses all available threads.
batch_size : int, optional
batch_size : int, default=1
The batch size to use. Default is 1.
async_io : bool, optional
async_io : bool, default=False
Whether to use asynchronous I/O. Default is False.
device : str, optional
device : str, default="auto"
The device to use. Default is "auto", which automatically selects the device.
viewagg_device : str, optional
viewagg_device : str, default="auto"
The view aggregation device to use. Default is "auto", which automatically selects the device.
Returns
Expand Down Expand Up @@ -461,9 +461,9 @@ def load_volumes(
----------
mode : ModalityMode
The mode of operation. Can be 't1', 't2', or 't1t2'.
t1_path : Optional[Path], optional
t1_path : Path, optional
The path to the T1 image. Default is None.
t2_path : Optional[Path], optional
t2_path : Path, optional
The path to the T2 image. Default is None.
Returns
Expand Down Expand Up @@ -583,7 +583,7 @@ def get_prediction(
A dictionary containing the configurations for each plane.
out_scale : optional
The output scale. Default is None.
mode : ModalityMode, optional
mode : ModalityMode, default="t1t2"
The mode of operation. Can be 't1', 't2', or 't1t2'. Default is 't1t2'.
Returns
Expand Down Expand Up @@ -644,7 +644,7 @@ def set_up_cfgs(
The configuration node to load.
out_dir : Path
The output directory where the results will be stored.
batch_size : int, optional
batch_size : int, default=1
The batch size to use. Default is 1.
Returns
Expand Down
4 changes: 2 additions & 2 deletions HypVINN/utils/img_processing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def save_segmentation(
The directory where the subject's data is stored.
seg_file : Path
The file where the segmentation results will be saved.
save_mask : bool, optional
save_mask : bool, default=False
Whether to save the mask or not. Default is False.
Returns
Expand Down Expand Up @@ -181,7 +181,7 @@ def get_clean_mask(segmentation: np.ndarray, optic=False) \
----------
segmentation : np.ndarray
The input segmentation mask.
optic : bool, optional
optic : bool, default=False
A flag indicating whether to consider optic labels. Default is False.
Returns
Expand Down
4 changes: 2 additions & 2 deletions HypVINN/utils/mode_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def get_hypinn_mode(
Parameters
----------
t1_path : Optional[Path], default=None
t1_path : Path, optional
The path to the T1 file.
t2_path : Optional[Path], default=None
t2_path : Path, optional
The path to the T2 file.
Returns
Expand Down
2 changes: 1 addition & 1 deletion HypVINN/utils/stats_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def compute_stats(
Returns
-------
int | str
int, str
The return value of the main function from FastSurferCNN.segstats.
Exit code. Returns 0 upon successful execution.
Expand Down
12 changes: 6 additions & 6 deletions HypVINN/utils/visualization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ def remove_values_from_list(the_list, val):


def get_lut(lookup_table_path: Path = HYPVINN_LUT):
"""
f"""
Retrieve a lookup table (LUT) from a file.
This function reads a file and constructs a lookup table (LUT) from it.
Parameters
----------
lookup_table_path: Path, default=HYPVINN_LUT
lookup_table_path: Path, default="{HYPVINN_LUT}"
The path to the file from which the LUT will be constructed.
Returns
Expand All @@ -70,14 +70,14 @@ def get_lut(lookup_table_path: Path = HYPVINN_LUT):


def map_hyposeg2label(hyposeg: np.ndarray, lut_file: Path = HYPVINN_LUT):
"""
f"""
Map a HypVINN segmentation to a continuous label space using a lookup table.
Parameters
----------
hyposeg : np.ndarray
The original segmentation map.
lut_file : Path, default=HYPVINN_LUT
lut_file : Path, default="{HYPVINN_LUT}"
The path to the lookup table file.
Returns
Expand Down Expand Up @@ -242,7 +242,7 @@ def plot_qc_images(
padd: int = 45,
lut_file: Path = HYPVINN_LUT,
slice_step: int = 2):
"""
f"""
Plot the quality control images for the subject.
Parameters
Expand All @@ -255,7 +255,7 @@ def plot_qc_images(
The path to the predicted image.
padd : int, default=45
The padding value for cropping the images and segmentations.
lut_file : Path, default=HYPVINN_LUT
lut_file : Path, default="{HYPVINN_LUT}"
The path to the lookup table file.
slice_step : int, default=2
The step size for selecting indices from the predicted segmentation.
Expand Down

0 comments on commit 706cb46

Please sign in to comment.