Skip to content

Commit 91c8958

Browse files
authored
Merge pull request #5 from yibeichan/main
standardize naming and packaging
2 parents 721b991 + 881079d commit 91c8958

File tree

7 files changed

+32
-25
lines changed

7 files changed

+32
-25
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ENV TEMP=/work
7878
ENV TMP=/work
7979

8080
# Create entrypoint script with proper permissions
81-
RUN echo '#!/bin/bash\nexec ants-nidm-bidsapp "$@"' > /entrypoint.sh && \
81+
RUN echo '#!/bin/bash\nexec ants-nidm "$@"' > /entrypoint.sh && \
8282
chmod 755 /entrypoint.sh
8383

8484
# Ensure all installed binaries are executable

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ This BIDS App follows standard BIDS Apps practices with a Dockerfile as the prim
4141
python setup.py docker
4242

4343
# Or directly with Docker
44-
docker build -t ants-nidm-bidsapp:latest .
44+
docker build -t ants-nidm_bidsapp:latest .
4545

4646
# Save for transfer to HPC (if needed)
47-
docker save ants-nidm-bidsapp:latest -o ants-nidm-bidsapp.tar
47+
docker save ants-nidm_bidsapp:latest -o ants-nidm_bidsapp.tar
4848
```
4949

5050
#### Building with Singularity/Apptainer (for HPC environments)
5151

5252
```bash
5353
# Direct build from Singularity definition file
5454
# The --fakeroot flag is required on HPC systems without root access
55-
apptainer build --fakeroot ants-nidm-bidsapp.sif Singularity
55+
apptainer build --fakeroot ants-nidm_bidsapp.sif Singularity
5656

5757
# Or using the setup.py helper
5858
python setup.py singularity
@@ -64,25 +64,25 @@ If you have a Docker image (either built locally or from a tar file):
6464

6565
```bash
6666
# From a saved Docker tar file
67-
singularity build ants-nidm-bidsapp.sif docker-archive://ants-nidm-bidsapp.tar
67+
singularity build ants-nidm_bidsapp.sif docker-archive://ants-nidm_bidsapp.tar
6868

6969
# From local Docker daemon (requires Docker)
70-
singularity build ants-nidm-bidsapp.sif docker-daemon://ants-nidm-bidsapp:latest
70+
singularity build ants-nidm_bidsapp.sif docker-daemon://ants-nidm_bidsapp:latest
7171
```
7272

7373
## Usage
7474

7575
### Basic Usage
7676

7777
```bash
78-
ants-nidm-bidsapp bids_dir output_dir participant --participant-label 01
78+
ants-nidm bids_dir output_dir participant --participant-label 01
7979
```
8080

8181
### Advanced Options
8282

8383
```bash
8484
# Full pipeline with all options
85-
ants-nidm-bidsapp bids_dir output_dir participant \
85+
ants-nidm bids_dir output_dir participant \
8686
--participant-label 01 \
8787
--session-label pre \
8888
--modality T1w \
@@ -98,7 +98,7 @@ If you have already run ANTs segmentation and only want to generate NIDM outputs
9898

9999
```bash
100100
# Run only NIDM conversion using existing ANTs results
101-
ants-nidm-bidsapp bids_dir output_dir participant \
101+
ants-nidm bids_dir output_dir participant \
102102
--participant-label 01 \
103103
--skip-ants \
104104
--ants-input /path/to/existing/ants-seg \

Singularity

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,4 @@ From: ubuntu:22.04
130130
singularity run [container] [input_dir] [output_dir] participant [options]
131131

132132
Example:
133-
singularity run ants-nidm-bidsapp.sif $PWD/inputs/data/BIDS $PWD/outputs/ants participant --participant-label 01 02 03 --session-label 01 --modality T1w
133+
singularity run ants-nidm_bidsapp.sif $PWD/inputs/data/BIDS $PWD/outputs/ants participant --participant-label 01 02 03 --session-label 01 --modality T1w

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ examples/
2222
To run the ANTs BIDS App on this example data:
2323

2424
```bash
25-
ants-bidsapp examples output participant --participant-label 01 02
25+
ants-nidm examples output participant --participant-label 01 02
2626
```
2727

2828
## Note

setup.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,31 @@
55
from setuptools import setup, find_namespace_packages
66

77

8+
# Container image constants - single source of truth for image names
9+
DOCKER_IMAGE_NAME = "ants-nidm_bidsapp"
10+
DOCKER_IMAGE_TAG = "latest"
11+
DOCKER_IMAGE = f"{DOCKER_IMAGE_NAME}:{DOCKER_IMAGE_TAG}"
12+
SINGULARITY_IMAGE_NAME = f"{DOCKER_IMAGE_NAME}.sif"
13+
14+
815
def build_docker():
916
"""Build Docker container"""
1017
print("Building Docker image...")
1118
try:
12-
subprocess.run(["docker", "build", "-t", "ants-nidm-bidsapp:latest", "."], check=True)
13-
print("Docker image built successfully: ants-nidm-bidsapp:latest")
19+
subprocess.run(["docker", "build", "-t", DOCKER_IMAGE, "."], check=True)
20+
print(f"Docker image built successfully: {DOCKER_IMAGE}")
1421
except subprocess.CalledProcessError as e:
1522
print(f"Docker build failed: {e}")
1623
return False
1724
return True
1825

1926

20-
def docker_to_singularity(docker_image="ants-nidm-bidsapp:latest", output_path=None):
27+
def docker_to_singularity(docker_image=DOCKER_IMAGE, output_path=None):
2128
"""Convert Docker image to Singularity container"""
2229
print(f"Converting Docker image {docker_image} to Singularity...")
2330

2431
# Use custom output path if provided, otherwise use default
25-
output_file = output_path if output_path else "ants-nidm-bidsapp.sif"
32+
output_file = output_path if output_path else SINGULARITY_IMAGE_NAME
2633
output_file = str(Path(output_file).resolve())
2734

2835
try:
@@ -59,7 +66,7 @@ def build_singularity(output_path=None):
5966
):
6067
print("\nDetected Apptainer on cluster environment.")
6168
print("For cluster environments, please build directly with apptainer:")
62-
print("apptainer build --fakeroot ants-nidm-bidsapp.sif Singularity\n")
69+
print(f"apptainer build --fakeroot {SINGULARITY_IMAGE_NAME} Singularity\n")
6370
return False
6471
elif (
6572
subprocess.run(["which", "singularity"], capture_output=True).returncode == 0
@@ -70,7 +77,7 @@ def build_singularity(output_path=None):
7077
return False
7178

7279
# Use custom output path if provided, otherwise use default
73-
output_file = output_path if output_path else "ants-nidm-bidsapp.sif"
80+
output_file = output_path if output_path else SINGULARITY_IMAGE_NAME
7481
output_file = str(Path(output_file).resolve())
7582

7683
# Build command
@@ -92,9 +99,9 @@ def build_singularity(output_path=None):
9299
except subprocess.CalledProcessError as e:
93100
print(f"Build failed: {e}")
94101
print("\nFor cluster environments, please build directly with apptainer:")
95-
print("apptainer build --remote ants-nidm-bidsapp.sif Singularity")
102+
print(f"apptainer build --remote {SINGULARITY_IMAGE_NAME} Singularity")
96103
print("or")
97-
print("apptainer build --fakeroot ants-nidm-bidsapp.sif Singularity")
104+
print(f"apptainer build --fakeroot {SINGULARITY_IMAGE_NAME} Singularity")
98105
return False
99106

100107

@@ -126,7 +133,7 @@ def print_usage():
126133
print("\nOther Commands:")
127134
print(" python setup.py --init-git - Initialize git submodules")
128135
print("\nNote: For HPC environments without Docker, use 'singularity' command directly:")
129-
print(" apptainer build --fakeroot ants-nidm-bidsapp.sif Singularity")
136+
print(f" apptainer build --fakeroot {SINGULARITY_IMAGE_NAME} Singularity")
130137
print("\nFor more information, run: python setup.py --help")
131138

132139

@@ -242,7 +249,7 @@ def install_antspyx():
242249
print(" python -m pip install -e .")
243250

244251
setup(
245-
name="ants-nidm_bidsapp",
252+
name="ants-nidm",
246253
version="0.1.0",
247254
description="BIDS App for ANTs Segmentation with NIDM Output",
248255
author="ReproNim",
@@ -263,7 +270,7 @@ def install_antspyx():
263270
],
264271
entry_points={
265272
"console_scripts": [
266-
"ants-nidm-bidsapp=src.run:main",
273+
"ants-nidm=src.run:main",
267274
],
268275
},
269276
python_requires=">=3.9",

src/antspy/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(self,
9999
self.verbose = verbose
100100

101101
# Set up logging
102-
self.logger = logging.getLogger('ants_bidsapp.segmentation')
102+
self.logger = logging.getLogger('ants-nidm.segmentation')
103103

104104
# Validate required directories
105105
if not self.bids_dir or not self.bids_dir.exists():

src/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def setup_logger(log_dir, verbose=False):
2929
"""Set up logging configuration."""
3030
os.makedirs(log_dir, exist_ok=True)
3131
timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
32-
log_file = os.path.join(log_dir, f"ants-nidm_bidsapp-{timestamp}.log")
32+
log_file = os.path.join(log_dir, f"ants-nidm-{timestamp}.log")
3333

3434
# Configure logging
3535
log_level = logging.DEBUG if verbose else logging.INFO
@@ -41,7 +41,7 @@ def setup_logger(log_dir, verbose=False):
4141
logging.StreamHandler()
4242
]
4343
)
44-
return logging.getLogger('ants-nidm_bidsapp')
44+
return logging.getLogger('ants-nidm')
4545

4646
def find_nidm_input_file(nidm_input_dir, subject_id, session_id=None):
4747
"""Search for NIDM input file in standard locations.

0 commit comments

Comments
 (0)