Skip to content

Commit

Permalink
[Update] Updated docstrings for DLMUSE and DLICV
Browse files Browse the repository at this point in the history
  • Loading branch information
spirosmaggioros committed Nov 28, 2024
1 parent ba8341c commit 9c7bb11
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 2 deletions.
37 changes: 37 additions & 0 deletions NiChart_DLMUSE/CalcROIVol.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ def create_roi_csv(
) -> None:
"""
Creates a csv file with the results of the roi calculations
:param mrid: the input mrid
:type mrid: Any
:param in_roi: the input ROI
:type in_roi: Any
:param map_derived_roi: derived roi map file
:type map_derived_roi: Any
:param out_csv: output csv filename
:type out_csv: str
:rtype: None
"""

# Calculate MUSE ROIs
Expand Down Expand Up @@ -140,6 +151,19 @@ def apply_create_roi_csv(
) -> None:
"""
Apply roi volume calc 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
:rtype: None
"""
if not os.path.exists(out_dir):
os.makedirs(out_dir)
Expand All @@ -158,6 +182,19 @@ def combine_roi_csv(
) -> None:
"""
Combine csv files
:param df_img: 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_name: the desired output filename
:type out_name: str
:rtype: None
"""
if not os.path.exists(out_dir):
os.makedirs(out_dir)
Expand Down
40 changes: 38 additions & 2 deletions NiChart_DLMUSE/SegmentImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,30 @@

def run_dlicv(
in_dir: str,
in_suff: Any,
in_suff: str,
out_dir: str,
out_suff: Any,
out_suff: str,
device: str,
extra_args: str = "",
) -> None:
"""
Run dlicv with the passed images
: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 device: cuda/mps for GPU acceleration otherwise cpu
:type device: str
:param extra_args: extra arguments for DLICV package
:type extra_args: str
:rtype: None
"""
# Call DLICV
os.system(f"DLICV -i {in_dir} -o {out_dir} -device {device} " + extra_args)

Expand All @@ -28,6 +46,24 @@ def run_dlmuse(
device: str,
extra_args: str = "",
) -> None:
"""
Run dlmuse with the passed images
: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 device: cuda/mps for GPU acceleration otherwise cpu
:type device: str
:param extra_args: extra arguments for DLMUSE package
:type extra_args: str
:rtype: None
"""
# Call DLMUSE
os.system(f"DLMUSE -i {in_dir} -o {out_dir} -device {device} " + extra_args)

Expand Down
15 changes: 15 additions & 0 deletions NiChart_DLMUSE/dlmuse_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ def run_pipeline(
) -> None:
"""
NiChart pipeline
:param in_data: the input directory
:type in_data: str
:param out_dir: the output directory
:type out_dir: str
:param device: conda/mps for GPU acceleration otherwise cpu
:type device: str
:param dlmuse_extra_args: extra arguments for DLMUSE package
:type dlmuse_extra_args: str
:param dlicv_extra_args: extra arguments for DLICV package
:type dlicv_extra_args: str
:param sub_fldr: the number of subfolders(default = 1)
:type sub_fldr: int
:rtype: None
"""
logging.info(f"Starting the pipeline on folder {sub_fldr}")
logging.info(f"Detecting input images for batch [{sub_fldr}]...")
Expand Down

0 comments on commit 9c7bb11

Please sign in to comment.