Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed installation issues of #3 #4

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# **NiChart<sup>Workflows</sup>**
# **NiChart<sup>Workflows</sup>**

A toolkit that allows users to apply **NiChart** processing methods and pre-trained models on their data. **NiChart<sup>Workflows</sup>** includes tools for [data harmonization](https://neuroimagingchart.com/components/#Harmonization) and [machine learning](https://neuroimagingchart.com/components/#Machine%20Learning), using pre-trained models and reference distributions provided by [**NiChart<sup>Engine</sup>**](https://github.com/gurayerus/NiChart_Engine). **NiChart<sup>Workflow</sup>** utilizes [Snakemake](https://snakemake.github.io) workflows to define multi-step image processing and data analytics pipelines.

Expand All @@ -13,7 +13,7 @@ Install dependencies for the **NiChart<sup>Workflows</sup>** in a conda environm
```bash
conda install -n base -c conda-forge mamba # If needed
mamba init # If first time installing, then potentially source ~/.bashrc
mamba create -c conda-forge -c bioconda -n NiChart_Workflows python=3.8
mamba create -c conda-forge -c bioconda -n NiChart_Workflows python=3.12
mamba activate NiChart_Workflows
pip install NiChart-Viewer-Demo spare-scores NiChartHarmonize
mamba install -c conda-forge -c bioconda snakemake
Expand Down Expand Up @@ -58,7 +58,7 @@ If the workflow works successfully, workflow steps will be run on the data. Resu

> "../../output/vTest1",

and the viewer will be launched with the combined result file as input.
and the viewer will be launched with the combined result file as input.

## Contributing:

Expand All @@ -76,4 +76,3 @@ This project is licensed under the [License Name] license. Please refer to the L
## Contact:

For any inquiries, please contact [email protected]. (Last Updated: 5/24/2024)

1 change: 1 addition & 0 deletions input/vTest2/Study1/Images/Images

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @spirosmaggioros , is this a symlink for your testing? Maybe add this filepath pattern to .gitignore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sure, i though it was already in the gitignore but it didnt, git status didnt show me this.
Also, as you see i clone the DLMUSE directly and build it from the repo. I downloaded the nnUNet model folder from the tag and manually put it inside the w_sMRI folder(where the snakefile is located). So this is pretty much my work-folder. I will make it more user friendly in the future, i just have to find a way to fully run it first :)

21 changes: 17 additions & 4 deletions utils/dlmuse/util_dlmuse_apply.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
#! /bin/bash -x

# download NiChart DLMUSE package
echo "Downloading NiChart DLMUSE..."
if [ -d "/NiChart_DLMUSE" ]
then
echo "Clone already exists!"
else
git clone https://github.com/CBICA/NiChart_DLMUSE.git
fi
cd NiChart_DLMUSE
pip install .
cd ..
echo "NiChart DLMUSE downloaded!"
echo "About to run: $0 $@"


## Read input
in_csv=$(realpath $1)
out_csv=$(realpath $2)
out_csv=$2

## Prep init data
in_dir=$(dirname ${in_csv})
Expand All @@ -14,10 +27,10 @@ tmp_dir="${out_dir}/tmprun_dlmuse"
mkdir -pv "${tmp_dir}/nnUNet_preprocessed"
mkdir -pv "${tmp_dir}/nnUNet_raw_database"
mkdir -pv "${tmp_dir}/nnUNet_out"
ln -s `realpath ../../../../NiChart/NiChart_Models/nnUNet_model` ${tmp_dir}/nnUNet_model
ln -s `realpath ./nnUNet_model` "${tmp_dir}/nnUNet_model"
ln -s `realpath ${in_dir}/Images` "${tmp_dir}/nnUNet_raw_database/nnUNet_raw_data"
droi=`realpath ../../../../NiChart/NiChart_DLMUSE/shared/dicts/MUSE_mapping_derived_rois.csv`
roi=`realpath ../../../../NiChart/NiChart_DLMUSE/shared/dicts/MUSE_mapping_consecutive_indices.csv`
droi=`realpath NiChart_DLMUSE/shared/dicts/MUSE_mapping_derived_rois.csv`
roi=`realpath NiChart_DLMUSE/shared/dicts/MUSE_mapping_consecutive_indices.csv`

## Apply dlmuse test
cmd="NiChart_DLMUSE --indir ${tmp_dir}/nnUNet_raw_database/nnUNet_raw_data --outdir ${tmp_dir}/nnUNet_out --pipelinetype structural --derived_ROI_mappings_file $droi --MUSE_ROI_mappings_file $roi --nnUNet_raw_data_base ${tmp_dir}/nnUNet_raw_database --nnUNet_preprocessed ${tmp_dir}/nnUNet_preprocessed --model_folder ${tmp_dir}/nnUNet_model --all_in_gpu True --mode fastest --disable_tta"
Expand Down
15 changes: 15 additions & 0 deletions utils/spare/util_spare_test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#! /bin/bash

# download spare package
echo "Downloading spare score package..."
if [ -d "/spare_score" ]
then
echo "spare score clone already exists!"
else
git clone https://github.com/CBICA/spare_score.git
fi
python setup.py bdist_wheel
cd dist
WHEEL_FILE=$(ls spare_scores*)
pip install "$WHEEL_FILE"
cd ..
echo "spare score is downloaded!"

## Read input
in_csv=$1
in_mdl=$2
Expand Down
8 changes: 4 additions & 4 deletions workflows/w_sMRI/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import os
#report: "report/workflow.rst"

###################################
## Default config file
## Default config file
## Runs the workflow with the test dataset
## Edit this for running it on other datasets
in_config = "../../config/vTest1/config.yaml"
in_config = "../../config/vTest2/config.yaml"
#in_config = "../../config/vTest2/config.yaml"
configfile: f"{in_config}"
###################################
Expand Down Expand Up @@ -192,7 +192,7 @@ rule calc_derived_ROIs:
'''
Calculate derived ROIs from harmonized data
- If the input data already includes derived ROIs, they will not be updated
'''
'''
input:
in_csv=f"../../{dir_output}/{{study}}/out_combat/{{study}}_{{dtype}}_COMBAT_single.csv",
dict=f"../../{derived_rois}"
Expand Down Expand Up @@ -293,7 +293,7 @@ rule launch_viewer:
touch(f"../../{dir_output}/flag_VIEWED.csv"),
shell:
"NiChart_Viewer --data_file {input}"

## Delete flag for the viewer, so that it will launch the viewer next time
if os.path.exists(f"../../{dir_output}/flag_VIEWED.csv"):
os.remove(f"../../{dir_output}/flag_VIEWED.csv")