Skip to content

Commit

Permalink
[Update] Last update on docstrings | Docstrings fully done
Browse files Browse the repository at this point in the history
  • Loading branch information
spirosmaggioros committed Nov 28, 2024
1 parent 9c7bb11 commit 70d0085
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 4 deletions.
34 changes: 32 additions & 2 deletions NiChart_DLMUSE/RelabelROI.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,21 @@ def relabel_rois(
) -> None:
"""
Convert labels in input roi image to new labels based on the mapping
print()
The mapping file should contain numeric indices for the mapping
irint()
between the input roi image (from) and output roi image (to)
:param in_img: the passed image
:type in_img: niftii image
:param roi_map: the passed roi map
:type roi_map: str
:param label_from: input roi image
:type label_from: Any
:param label_to: output roi image
:type label_to: Any
:param out_img: the desired filename for the output image
:type out_img: str
:rtype: None
"""

# Read image
Expand Down Expand Up @@ -52,6 +63,25 @@ def apply_relabel_rois(
) -> None:
"""
Apply relabeling to all images
:param df_img: the passed dataframe
:type df_img: pd.DataFrame
:param in_dir: the input directory
:type in_dir: str
:param in_suff: the input suffix
:type in_suff: str
:param out_dir: the output directory
:type out_dir: str
:param out_suff: the output suffix
:type out_suff: str
:param roi_map: the roi map
:type roi_map: Any
:param label_from: input roi image
:type label_from: Any
:param label_to: output roi image
:type label_to: Any
:rtype: None
"""
if not os.path.exists(out_dir):
os.makedirs(out_dir)
Expand Down
33 changes: 31 additions & 2 deletions NiChart_DLMUSE/ReorientImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@
logging.basicConfig(filename="pipeline.log", encoding="utf-8", level=logging.DEBUG)


def reorient_img(in_img: Any, ref: Any, out_img: Any) -> None:
def reorient_img(in_img: Any, ref: Any, out_img: str) -> None:
"""
Reorient image
:param in_img: the input image
:type in_img: niftii image
:param out_img: the desired filename for the output image
:type out_img: str
:rtype: None
"""
if os.path.exists(out_img):
logging.info("Out file exists, skip reorientation ...")
Expand Down Expand Up @@ -50,6 +57,15 @@ def apply_reorient_img(
) -> None:
"""
Apply reorientation to all images
:param df_img: the passed dataframe
:type df_img: pd.DataFrame
:param out_dir: the output directory
:type out_dir: str
:param out_suffix: the output suffix
:type out_suffix: str
:rtype: None
"""
if not os.path.exists(out_dir):
os.makedirs(out_dir)
Expand All @@ -61,10 +77,23 @@ def apply_reorient_img(


def apply_reorient_to_init(
df_img: pd.DataFrame, in_dir: str, in_suff: Any, out_dir: str, out_suff: str
df_img: pd.DataFrame, in_dir: str, in_suff: str, out_dir: str, out_suff: str
) -> None:
"""
Apply reorientation to init img to all images
:param df_img: the passed dataframe
:type df_img: pd.DataFrame
:param in_dir: the input directory
:type in_dir: str
:param in_suff: the input suffix
:param in_suff: str
:param out_dir: the output directory
:type out_dir: str
:param out_suff: the output suffix
:type out_suff: str
:rtype: None
"""
if not os.path.exists(out_dir):
os.makedirs(out_dir)
Expand Down

0 comments on commit 70d0085

Please sign in to comment.