Skip to content

Commit

Permalink
Merge branch 'main' into wrapper_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanARashid committed Jul 8, 2024
2 parents 8f5d07b + ecc5658 commit 09f5c4f
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 3 deletions.
16 changes: 16 additions & 0 deletions Docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Ignore editor and system files
.vscode/
.git/
.gitignore
*.md

# Exclude development and test artifacts
__pycache__
conftest

# Docs
docs
doc

# Others

17 changes: 17 additions & 0 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.11-slim

WORKDIR /usr/src/app

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libssl-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY ../requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt

COPY .. .

ENTRYPOINT ["python3", "-m", "WrapImage.nifti_wrapper"]
61 changes: 61 additions & 0 deletions Docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# TF2.4_IVIM-MRI_CodeCollection

This project is designed to run the `nifti_wrapper` script using a Docker container. Below are the steps to build and run the Docker image.

## Prerequisites

- Docker must be installed on your system.

## Directory Structure

```
~/TF2.4_IVIM-MRI_CodeCollection/
├── Docker/
│ └── Dockerfile
├── WrapImage/
│ └── nifti_wrapper.py
└── requirements.txt
```

## Options

Before running the Docker container, here are the available options for the `Docker image` script:

- `input_file`: Path to the input 4D NIfTI file.
- `bvec_file`: Path to the b-vector file.
- `bval_file`: Path to the b-value file.
- `--affine`: Affine matrix for NIfTI image (optional).
- `--algorithm`: Select the algorithm to use (default is "OJ_GU_seg").
- `algorithm_args`: Additional arguments for the algorithm (optional).

## Building the Docker Image

1. Open a terminal and navigate to the project directory:

```sh
cd ~/TF2.4_IVIM-MRI_CodeCollection
```

2. Build the Docker image using the `docker build` command:

```sh
sudo docker build -t tf2.4_ivim-mri_codecollection -f Docker/Dockerfile .
```

## Running the Docker Container

1. Once the image is built, you can run the Docker container using the `docker run` command. This command runs the Docker image with the specified input files:

```sh
sudo docker run -it --rm --name TF2.4_IVIM-MRI_CodeCollection \
-v ~/TF2.4_IVIM-MRI_CodeCollection:/usr/src/app \
-v ~/TF2.4_IVIM-MRI_CodeCollection:/usr/app/output \
tf2.4_ivim-mri_codecollection Downloads/brain.nii.gz Downloads/brain.bvec Downloads/brain.bval \
```

Replace `brain.nii.gz`, `brain.bvec`, and `brain.bval` with the actual file names you want to use.

---
2 changes: 1 addition & 1 deletion WrapImage/nifti_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def loop_over_first_n_minus_1_dimensions(arr):
parser.add_argument("bval_file", type=str, help="Path to the b-value file.")
parser.add_argument("--affine", type=float, nargs="+", help="Affine matrix for NIfTI image.")
parser.add_argument("--algorithm", type=str, default="OJ_GU_seg", help="Select the algorithm to use.")
parser.add_argument("algorithm_args", nargs=argparse.REMAINDER, help="Additional arguments for the algorithm.")
parser.add_argument("--algorithm_args", nargs=argparse.REMAINDER, help="Additional arguments for the algorithm.")

args = parser.parse_args()

Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ numpy
scipy
torchio
torch
logging
joblib
dipy
matplotlib
Expand All @@ -13,4 +12,4 @@ pytest
tqdm
pandas
sphinx
sphinx_rtd_theme
sphinx_rtd_theme

0 comments on commit 09f5c4f

Please sign in to comment.