I have my own image registration tool that I've created on my own local 
instance of galaxy.

The method takes in two images (*.nii.gz) formats and registers them together, 
and produces one registered *.nii.gz file and a *.trsf matrix file.

The first issue encountered was the method was expecting *.nii.gz files as 
inputs but was receiving *.dat files. I navigated around this problem as shown 
by the files below:

- <<tool id="RegisterAliBabaAffine" name="RegisterAffine">
  <  <description>two images</description>
  <  <command 
interpreter="bash">$__root_dir__/tools/registration/reg-wrapper.sh $moving 
$fixed $outputTRSF $outputImage</command>
- <  <inputs>
  <    <param format="binary" name="moving" type="data" label="Moving Image" />
  <    <param format="binary" name="fixed" type="data" label="Fixed Image" />
  <    <param type="hidden" name="outputTRSF" value="output.trsf" label="trsf 
file" help="Output File must have .trsf extension" />
  <    <param type="hidden" name="outputImage" value="output.nii.gz" 
label="Image output file" help="Output Image File must have .nii.gz extension" 
- <  <outputs>
  <    <data format="input" name="output_TRSF" from_work_dir="output.trsf" />
  <    <data format="input" name="output_Image" from_work_dir="output.nii.gz" />
  <  <help>This tool uses Affine Registration to register two images.</help>

MOVING=`mktemp --suffix .nii.gz`
FIXED=`mktemp --suffix .nii.gz`
cat $1 > $MOVING
cat $2 > $FIXED
/usr/local/MILXView.12.08.1/BashScripts/RegisterAliBabaAffine -m $MOVING -f 
$FIXED -t $3 -o $4
if [[ $RC == 0 ]]; then
  OUTPUTTRSF=`mktemp --suffix .trsf`
  OUTPUTIMG=`mktemp --suffix .nii.gz`
  cat  $OUTPUTTRSF > $3
  cat  $OUTPUTIMG > $4


exit $RC

This allows them to pass the *.nii.gz files that the registration method is 

Everything works fine and I can see output generated in the job_working_dir and 
the history turns green...

galaxy@bmladmin-OptiPlex-745:~$ ls -lrt 

total 2940

-rw------- 1 galaxy nogroup       0 Sep 13 10:15 tmpRfHsOP_stderr

-rw-r--r-- 1 galaxy nogroup     241 Sep 13 10:35 output.trsf

-rw------- 1 galaxy nogroup      80 Sep 13 10:35 tmplmK0V2_stdout

-rw-r--r-- 1 galaxy nogroup 2998272 Sep 13 10:38 output.nii.gz

However, the problem occurs when the files are copied from 
~/galaxy-dist/database/job_working_directory/000/27/ to 
~/galaxy-dist/database/files/000/. When this happens the files become size = 0.

Any ideas?

-rw-r--r-- 1 galaxy nogroup       0 Sep 13 09:36 

-rw-r--r-- 1 galaxy nogroup       0 Sep 13 09:36 

-rw-r--r-- 1 galaxy nogroup       0 Sep 13 10:38 

-rw-r--r-- 1 galaxy nogroup       0 Sep 13 10:38 

The output in galaxy.log indicates it is successful:

/home/galaxy/galaxy-dist/database/files/000/dataset_20.dat output.trsf 
output.nii.gz galaxy.jobs DEBUG 2012-09-13 10:38:10,334 The tool did not define 
exit code or stdio handling; checking stderr for success galaxy.jobs DEBUG 
2012-09-13 10:38:10,361 finish(): Moved 
/home/galaxy/galaxy-dist/database/job_working_directory/000/27/output.trsf to 
/home/galaxy/galaxy-dist/database/files/000/dataset_42.dat as directed by 
from_work_dir galaxy.jobs DEBUG 2012-09-13 10:38:10,380 finish(): Moved 
/home/galaxy/galaxy-dist/database/job_working_directory/000/27/output.nii.gz to 
/home/galaxy/galaxy-dist/database/files/000/dataset_43.dat as directed by 
from_work_dir galaxy.jobs DEBUG 2012-09-13 10:38:10,609 job 27 ended

Is the issue copying *.nii.gz files and *.trsf file into *.dat files? Anyway 
around this?

I've also modified ~/galaxy-dist/lib/galaxy/jobs/__init__.py (line 363) to 
change shutil.move

To shutil.copy2 (same results)

Also put in a different output path to copy to. But essentially we have files 
with size in ~/galaxy-dist/database/job_working_directory/000/id/, but they 
files are size  0 after the move into ~/galaxy-dist/database/files/000


The Galaxy User list should be used for the discussion of
Galaxy analysis and other features on the public server
at usegalaxy.org.  Please keep all replies on the list by
using "reply all" in your mail client.  For discussion of
local Galaxy instances and the Galaxy source code, please
use the Galaxy Development list:


To manage your subscriptions to this and other Galaxy lists,
please use the interface at:


Reply via email to