users > Unable to read reference image
Showing 1-12 of 12 posts
Display:
Results per page:
Mar 13, 2017  08:03 PM | Dan Xie - UCSF
Unable to read reference image
Hi Developers, 

I reinstalled CMTK and its FIJI GUI plugin on a windows machine, then installed Perl. While creating a script using the GUI, I got an error message: 

'OSError: [Errno 20047] Unknown error: 20047: u'D:\\Data\\cmtk_registration\\commands\\munger_2017-03-13_13.19.22.sh'

But I thought this is just the os.chmod error in Windows and ignored it. The generated script is: 

#!/bin/sh
# 2017-03-13_12.21.50
cd "D:\Data\cmtk_registration"
"C:\Users\Admin\Desktop\Fiji.app\bin\cmtk\munger" -b "C:\Users\Admin\Desktop\Fiji.app\bin\cmtk" -a -w -r 010203 -X 26 -C 8 -G 80 -R 4 -A '--accuracy 0.4' -W '--accuracy 0.4' -v -T 1 -s "ref_FB\Nov01_2016_B3ZD.nrrd" images_FB

However, either double clicking or running from terminals (I use git bash) does nothing. Here is the output after a git bash run: 

hostname = Admin-PC; short hostname = Admin-PC
User path is /c/Users/Admin/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Admin/bin:/c/Program Files (x86)/WANdisco/Subversion:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/jEdit:/c/Program Files/Point Grey Research/FlyCapture2/bin64:/c/Anaconda3:/c/Anaconda3/Scripts:/c/Anaconda3/Library/bin:/cmd:/c/Program Files/Point Grey Research/FlyCap2 Viewer/bin64:/c/Strawberry/perl/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/c/bin:/usr/bin/vendor_perl:/usr/bin/core_perl
Reference brain is ref_FB\Nov01_2016_B3ZD_ref.nrrd
Reference brain stem is ref
JOB ID =
Start time is: 1489437302 seconds
Root directory is /d/Data/cmtk_registration
Changing to root directory: images_FB
Setting image root to: images_FB
-------------------------
Rescanning images directory a second time
-------------------------

Ran 0 initial affine registrations of which 0 failed
Ran 0 affine registrations of which 0 failed
Ran 0 warp registrations
Reformatted 0 images

it seems no images are really processed. Is my script incomplete? 

Best,
Dan
Mar 13, 2017  09:03 PM | Greg Jefferis
Unable to read reference image
Dear Dan,

This is a problem specifically with the munger script. munger is quite fussy about certain input file and directory names. There are couple of odd things here:

> Reference brain stem is ref
> JOB ID =
> Start time is: 1489437302 seconds
> Root directory is /d/Data/cmtk_registration
> Changing to root directory: images_FB
> Setting image root to: images_FB


1. The reference brain stem is ref. Your reference brain is:

Nov01_2016_B3ZD.nrrd

It is better to use names without underscores. These have a special meaning for munger and things may be fragile if your names do not conform to expectations.

2. There might be a problem with the name of the directory containing your input images. It should normally be called images not images_FB.

Best,

Greg.
Mar 13, 2017  10:03 PM | Dan Xie - UCSF
RE: Unable to read reference image
Thanks Greg! I removed all the underscores from my folder names and file names and regenerated the script. Now the output becomes:

$ sh munger_2017-03-13_14.52.36.sh
hostname = Admin-PC; short hostname = Admin-PC
User path is /c/Users/Admin/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Admin/bin:/c/Program Files (x86)/WANdisco/Subversion:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/jEdit:/c/Program Files/Point Grey Research/FlyCapture2/bin64:/c/Anaconda3:/c/Anaconda3/Scripts:/c/Anaconda3/Library/bin:/cmd:/c/Program Files/Point Grey Research/FlyCap2 Viewer/bin64:/c/Strawberry/perl/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/c/bin:/usr/bin/vendor_perl:/usr/bin/core_perl
Reference brain is refbrain\Nov012016B3ZDref.nrrd
Reference brain stem is refbrain\Nov012016B3ZDref
JOB ID =
Start time is: 1489442230 seconds
Root directory is /d/Data/cmtk_registration
Changing to root directory: /d/Data/cmtk_registration
Setting image root to: images
Found brain name FBZD 01 (images/FBZD01.nrrd)
New working directory is: /d/Data/cmtk_registration, Old one was /d/Data/cmtk_registration/images
MYEXEC: CMD = mkdir -p Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list exited with value 0
A: Running affine reg with command: C:/Users/Admin/Desktop/Fiji.app/bin/cmtk/registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list refbrain\Nov012016B3ZDref.nrrd images/FBZD01.nrrd
C:/Users/Admin/Desktop/Fiji.app/bin/cmtk/registration.exe: error while loading shared libraries: cygstdc++-6.dll: cannot open shared object file: No such file or directory
MYEXEC: CMD = C:/Users/Admin/Desktop/Fiji.app/bin/cmtk/registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list refbrain\Nov012016B3ZDref.nrrd images/FBZD01.nrrd exited with value 127
inlist = Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list
W: outlist = Registration/warp/refbrain/Nov012016B3ZDref_FBZD01_warp_m0g80c8e1e-1x26r4.list
Reformat:inlist would be: Registration/warp/refbrain/Nov012016B3ZDref_FBZD01_warp_m0g80c8e1e-1x26r4.list
Found brain name FBZD 02 (images/FBZD02.nrrd)
New working directory is: /d/Data/cmtk_registration, Old one was /d/Data/cmtk_registration/images
Reformat:inlist would be: Registration/warp/refbrain/Nov012016B3ZDref_FBZD01_warp_m0g80c8e1e-1x26r4.list
-------------------------
Rescanning images directory a second time
-------------------------
Found brain name FBZD 01 (images/FBZD01.nrrd)
New working directory is: /d/Data/cmtk_registration, Old one was /d/Data/cmtk_registration/images
A: Running affine reg with command: C:/Users/Admin/Desktop/Fiji.app/bin/cmtk/registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list refbrain\Nov012016B3ZDref.nrrd images/FBZD01.nrrd
C:/Users/Admin/Desktop/Fiji.app/bin/cmtk/registration.exe: error while loading shared libraries: cygstdc++-6.dll: cannot open shared object file: No such file or directory
MYEXEC: CMD = C:/Users/Admin/Desktop/Fiji.app/bin/cmtk/registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list refbrain\Nov012016B3ZDref.nrrd images/FBZD01.nrrd exited with value 127
inlist = Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list
W: outlist = Registration/warp/refbrain/Nov012016B3ZDref_FBZD01_warp_m0g80c8e1e-1x26r4.list
Reformat:inlist would be: Registration/warp/refbrain/Nov012016B3ZDref_FBZD01_warp_m0g80c8e1e-1x26r4.list
Found brain name FBZD 02 (images/FBZD02.nrrd)
New working directory is: /d/Data/cmtk_registration, Old one was /d/Data/cmtk_registration/images
Reformat:inlist would be: Registration/warp/refbrain/Nov012016B3ZDref_FBZD01_warp_m0g80c8e1e-1x26r4.list

Ran 0 initial affine registrations of which 0 failed
Ran 2 affine registrations of which 2 failed
Ran 0 warp registrations
Reformatted 0 images

I highlighted the error message which I thought is the problem. Running the script from git bash or double-clicking creates a folder named "Registration", but there is only another .sh script wrapped by several layers of folders.  Is my system lacking anything needed by the tool?

Thanks again!

Best,
Mar 14, 2017  01:03 AM | Greg Jefferis
RE: Unable to read reference image
That looks like a generic Cygwin install issue - there is a missing library. I'm no Cygwin expert, so you'll just have to google the error message for advice on how to install the missing components.

Best, Greg

Mar 14, 2017  01:03 AM | Greg Jefferis
RE: Unable to read reference image
PS the approach that I have used for setting up CMTK under Cygwin for use with our R tools is documented here:

http://jefferis.github.io/nat/articles/I...

Mar 14, 2017  03:03 PM | Torsten Rohlfing
RE: Unable to read reference image
Hi Dan -

This looks like CMTK's binaries are no longer in sync with library versions in the current Cygwin. Specifically, it appears that there has been a major version upgrade in the C++ standard library.

I will try to provide an updated build in the next few days.

Best,
  Torsten
Mar 14, 2017  05:03 PM | Dan Xie - UCSF
RE: Unable to read reference image
Thanks Greg! I followed the instruction in your link and everything seems normal so far. But I was wondering if it is possible to run registration directly in R, or the R-CMTK interface is only a visualization tool for registration results? I looked through the reference page and did not see much information. Is it possible to generate and run the munger script in R environment?
Mar 14, 2017  06:03 PM | Dan Xie - UCSF
RE: Unable to read reference image
Thanks for looking into the problem!  I added C:\cygwin64\bin into the system path list, so cmtk found the c++ library. However, with all the required libraries there, a cygheap base mismatch was always detected when I run the munger script. I reinstalled cygwin and CMTK for a few times and rebooted Windows after every installation, but the problem remains and I did not know how to solve it. 

Best,
Dan
Mar 15, 2017  04:03 AM | Torsten Rohlfing
RE: Unable to read reference image
Dan,

I uploaded an updated version of the CMTK Cygwin binaries: https://www.nitrc.org/frs/download.php/9901/CMTK-3.3.1-CYGWIN-x86_64.tar.gz

This is build with the latest Cygwin x86_64 libraries as of today, so if you have any library version mismatches, those should disappear after updating your Cygwin install (sounds like you already did) and installing the package above.

Best,
  Torsten
Mar 20, 2017  06:03 PM | Dan Xie - UCSF
RE: Unable to read reference image
Hi Torsten,

Thank you so much for spending time to rebuild the package! I appreciate your help. Now the incompatibility disappears, but the package cannot find my data files. 

My working folder is: D:\Data\cmtkRegistration
which originally contains three folders: 
D:\Data\cmtkRegistration\commands (generated by CMTK GUI)
D:\Data\cmtkRegistration\images (created by me, contains two image stacks FBZD01.nrrd, FBZD02.nrrd)
D:\Data\cmtkRegistration\refbrain (created by me, contains one reference image Nov012016B3ZDref.nrrd)

Since my FIJI cmtk plugin fails, I manually changed the paths of munger and cmtk in a previous munger script, so the script becomes:

#!/bin/sh
# 2017-03-14_10.13.30
cd "D:\Data\cmtkRegistration"
"C:\cygwin64\usr\local\bin\munger" -b "C:\cygwin64\usr\local\bin\cmtk" -a -w -r 010203 -X 26 -C 8 -G 80 -R 4 -A '--accuracy 0.4' -W '--accuracy 0.4' -T 1 -s "refbrain\Nov012016B3ZDref.nrrd" images

Running the munger script yields the error message: 

$ sh munger_2017-03-14_10.13.30.sh
hostname = Admin-PC; short hostname = Admin-PC
JOB ID =
Root directory is /d/Data/cmtkRegistration
Changing to root directory: /d/Data/cmtkRegistration
Setting image root to: images
Aff:FBZD01 MYEXEC: CMD = C:/cygwin64/usr/local/bin/cmtk/registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list refbrain\Nov012016B3ZDref.nrrd images/FBZD01.nrrd failed to execute: No such file or directory
Aff:FBZD01 MYEXEC: CMD = C:/cygwin64/usr/local/bin/cmtk/registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list refbrain\Nov012016B3ZDref.nrrd images/FBZD01.nrrd failed to execute: No such file or directory

Ran 0 initial affine registrations of which 0 failed
Ran 2 affine registrations of which 2 failed
Ran 0 warp registrations
Reformatted 0 images

The "Registration" folder is created upon the execution, which means it can recognize my working folder. However, the program insists that my image files don't exist. Do you have any idea what went wrong? 

Best,
Dan
Mar 20, 2017  07:03 PM | Greg Jefferis
RE: Unable to read reference image
cd into the registration root directory and make sure that you can ls the files using the exact paths that you report below.


Mar 20, 2017  08:03 PM | Dan Xie - UCSF
RE: Unable to read reference image
Admin@Admin-PC MINGW64 /d/Data/cmtkRegistration
$ ls refbrain/*
refbrain/Nov012016B3ZDref.nrrd

Admin@Admin-PC MINGW64 /d/Data/cmtkRegistration
$ ls images/*
images/FBZD01.nrrd images/FBZD02.nrrd

I am under the registration root folder /d/Data/cmtkRegistration.  ls on refbrain and images can find all the .nrrd files there. In the newly created folder "Registration", I also found a cmd.sh in the subfolder

D:\Data\cmtkRegistration\Registration\affine\refbrain\Nov012016B3ZDref_FBZD01_9dof.list

and the script is: 

Command was:
C:/cygwin64/usr/local/bin/cmtk/registration -i -v --dofs 6 --dofs 9 --accuracy 0.4  -o Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list refbrain\Nov012016B3ZDref.nrrd images/FBZD01.nrrd

But when I read the script with vim, it appears as 

Command was:
C:/cygwin64/usr/local/bin/cmtk/registration^@-i^@-v^@--dofs^@6^@--dofs^@9^@--accuracy^@0.4^@-o^@Registration/affine/refbrain/Nov012016B3ZDref_FBZD01_9dof.list^@refbrain\Nov012016B3ZDref.nrrd^@images/FBZD01.nrrd

in which all the spaces are replaced by ^@. If I type "cat cmd.sh" in terminal to display its contents, all the spaces are gone in the output. Do you think this is where the problem lies?