Skip to content

Commit

Permalink
Applying relative path changes in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
taha-abdullah committed Jun 4, 2024
1 parent 6fc25ec commit 79dc385
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions HypVINN/run_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# IMPORTS
import os.path
from typing import TYPE_CHECKING, Optional, cast, Literal
import argparse
from pathlib import Path
Expand All @@ -32,6 +32,7 @@
load_checkpoint_config_defaults,
)
from FastSurferCNN.utils.common import assert_no_root, SerialExecutor
from FastSurferCNN.utils.parser_defaults import FASTSURFER_ROOT

from HypVINN.config.hypvinn_files import HYPVINN_SEG_NAME
from HypVINN.data_loader.data_utils import hypo_map_label2subseg, rescale_image
Expand All @@ -46,6 +47,8 @@
from HypVINN.utils.stats_utils import compute_stats
from HypVINN.utils.visualization_utils import plot_qc_images

_doc_HYPVINN_SEG_NAME = os.path.relpath(HYPVINN_SEG_NAME, FASTSURFER_ROOT)

logger = logging.get_logger(__name__)

##
Expand Down Expand Up @@ -183,7 +186,7 @@ def main(
device: str = "auto",
viewagg_device: str = "auto",
) -> int | str:
"""
f"""
Main function of the hypothalamus segmentation module.
Parameters
Expand All @@ -208,8 +211,8 @@ def main(
The path to the coronal configuration file.
cfg_sag : Path
The path to the sagittal configuration file.
hypo_segfile : str, default="{HYPVINN_SEG_NAME}"
The name of the hypothalamus segmentation file. Default is HYPVINN_SEG_NAME.
hypo_segfile : str, default="{_doc_HYPVINN_SEG_NAME}"
The name of the hypothalamus segmentation file. Default is {_doc_HYPVINN_SEG_NAME}.
allow_root : bool, default=False
Whether to allow running as root user. Default is False.
qc_snapshots : bool, optional
Expand Down
11 changes: 7 additions & 4 deletions HypVINN/utils/visualization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os.path
from pathlib import Path

import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt

from HypVINN.config.hypvinn_files import HYPVINN_LUT
from FastSurferCNN.utils.parser_defaults import FASTSURFER_ROOT

_doc_HYPVINN_LUT = os.path.relpath(HYPVINN_LUT, FASTSURFER_ROOT)


def remove_values_from_list(the_list, val):
Expand Down Expand Up @@ -48,7 +51,7 @@ def get_lut(lookup_table_path: Path = HYPVINN_LUT):
Parameters
----------
lookup_table_path: Path, default="{HYPVINN_LUT}"
lookup_table_path: Path, default="{_doc_HYPVINN_LUT}"
The path to the file from which the LUT will be constructed.
Returns
Expand Down Expand Up @@ -77,7 +80,7 @@ def map_hyposeg2label(hyposeg: np.ndarray, lut_file: Path = HYPVINN_LUT):
----------
hyposeg : np.ndarray
The original segmentation map.
lut_file : Path, default="{HYPVINN_LUT}"
lut_file : Path, default="{_doc_HYPVINN_LUT}"
The path to the lookup table file.
Returns
Expand Down Expand Up @@ -255,7 +258,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="{_doc_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 79dc385

Please sign in to comment.