Skip to content

Commit

Permalink
updated so that input file names can be more generic. kitchell#10
Browse files Browse the repository at this point in the history
added config.json.sample
updated README slightly
  • Loading branch information
soichih committed Oct 5, 2018
1 parent 5afd926 commit cc62f62
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 33 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Abcdspec-compliant](https://img.shields.io/badge/ABCD_Spec-v1.1-green.svg)](https://github.com/brain-life/abcd-spec)
[![Run on Brainlife.io](https://img.shields.io/badge/Brainlife-bl.app.1-blue.svg)](https://doi.org/10.25663/bl.app.1)
[![Run on Brainlife.io](https://img.shields.io/badge/Brainlife-bl.app.108-blue.svg)](https://doi.org/10.25663/bl.app.108)

# app-generatetractsurfaces

Expand Down Expand Up @@ -48,7 +48,6 @@ Otherwise:

If you don't have your own input file, you can download sample datasets from Brainlife.io, or you can use [Brainlife CLI](https://github.com/brain-life/cli).


## Output

The main output of this App is a folder called 'surfaces'. This folder contains one surface mesh file for each input binary voxel file.
Expand Down
4 changes: 4 additions & 0 deletions config.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"maskdir": "../app-tractseg/tractseg_output/bundle_segmentations",
"filetype": "vtk"
}
27 changes: 1 addition & 26 deletions main
Original file line number Diff line number Diff line change
@@ -1,44 +1,19 @@
#!/bin/bash


#clean up previous job (just in case)
rm -f finished


#if [ $ENV == "IUHPC" ]; then
# module unload python
# if [ $HPC == "KARST" ]; then
# module load anaconda2
# fi
# if [ $HPC == "CARBONATE" ]; then
# module load anaconda/python2.7/4.3.1
# fi

#fi

#module unload python/2.7.3

module load singularity 2> /dev/null


# remove surface directory
rm -rf surfaces

echo "counting files"
NUMFILES=`numfiles.py`
NUMFILES=`python numfiles.py`
echo "there are $NUMFILES files"
echo "starting main"

#singularity exec -e docker://lukin0110/docker-vtk-python ./main.py
singularity exec -e docker://brainlife/pythonvtk ./main.py

#nohup time python main.py > stdout.log 2> stderr.log

#check for output files
#if [ -s Right_Uncinate_surf.vtk ];

count=$(ls surfaces/* | wc -l)

if [ "$count" == "$NUMFILES" ]
then
echo 0 > finished
Expand Down
9 changes: 6 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
filetype = config["filetype"]
for file in glob.glob(config["maskdir"] + "/*.nii.gz"):
print(file)
split_name = os.path.basename(file).split('_')
split_name[-1] = 'surf.' + filetype
surfname = '_'.join(split_name)
#split_name = os.path.basename(file).split('_')
#split_name[-1] = 'surf.' + filetype
#surfname = '_'.join(split_name)
#trim .nii.gz
split_name = os.path.basename(file).split('.nii.gz')
surfname = split_name[0]+"."+filetype
print(surfname)
niftiMask2Surface(file, 'surfaces/'+surfname, 10, filetype)
2 changes: 0 additions & 2 deletions numfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import fnmatch
import json



with open('config.json') as config_json:
config = json.load(config_json)

Expand Down

0 comments on commit cc62f62

Please sign in to comment.