Skip to content

Commit a47dba4

Browse files
fixing pipeline_loop_2mm.json location bug
1 parent 8122884 commit a47dba4

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/run_cortical_tiles.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ def run(self):
4949
# Convert input to absolute path
5050
input_abs = abspath(self.args.input)
5151

52-
# Copy pipeline config template inside the input directory
53-
# (generate_sulcal_regions.py always looks for it at {path_dataset}/pipeline_loop_2mm.json)
54-
config_file_path: str = join(input_abs, "pipeline_loop_2mm.json")
52+
# Copy pipeline config template into the output (derivatives) directory.
53+
# generate_sulcal_regions.py reads it from {path_dataset}/pipeline_loop_2mm.json,
54+
# and we pass output as -d so the config is never inside the subjects directory
55+
# (which would cause generate_skeletons.py to list it as a subject).
56+
config_file_path: str = join(abspath(self.args.output), "pipeline_loop_2mm.json")
5557
if not self.validate_paths([config_file_path]):
5658
source_config = abspath(join(
5759
dirname(__file__), '..', 'pipeline_loop_2mm.json'
@@ -104,7 +106,7 @@ def run(self):
104106
cmd = [
105107
sys.executable,
106108
script_path,
107-
"-d", input_abs,
109+
"-d", abspath(self.args.output),
108110
"--path_to_graph", self.args.path_to_graph,
109111
"--path_sk_with_hull", self.args.path_sk_with_hull,
110112
"--njobs", str(self.args.njobs)

tests/test_run_cortical_tiles.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,15 @@ def test_graphs_dir_set_to_input(self, temp_dir):
393393
def test_output_dir_set_from_output_arg(self, temp_dir):
394394
"""Test that output_dir in config is set to output/DERIVATIVES_FOLDER."""
395395
from utils.lib import DERIVATIVES_FOLDER
396-
config_data = {"graphs_dir": "$local", "output_dir": "$local"}
397-
config_path = Path(temp_dir) / "pipeline_loop_2mm.json"
398-
config_path.write_text(json.dumps(config_data))
399396

400397
output_dir = Path(temp_dir) / "derivatives"
401398
output_dir.mkdir()
402399

400+
# Config is placed inside the output (derivatives) directory, not the subjects dir
401+
config_data = {"graphs_dir": "$local", "output_dir": "$local"}
402+
config_path = output_dir / "pipeline_loop_2mm.json"
403+
config_path.write_text(json.dumps(config_data))
404+
403405
script = RunCorticalTiles()
404406
script.parse_args([
405407
temp_dir, str(output_dir),

0 commit comments

Comments
 (0)