users > Trouble with reading .nrrd in Windows
Showing 1-5 of 5 posts
Feb 14, 2018 05:02 PM | Ingrid Framås Syversen
Trouble with reading .nrrd in Windows
Hello,
I am trying to perform EPI unwarping in the Windows command line (CMD.EXE), but I have encountered a problem.
First, I type in:
I am sure that the file exists, so there must be some kind of problem reading the file. My operative system is Windows 7. I have tried the same thing in Cygwin (on the same computer), and there it works perfectly fine. However, I am going to do the EPI unwarping in another program (in MeVisLab, using an "External Executable Wrapper"), and I don't think that can be done via Cygwin. Therefore, I want this to work using only the Windows command line.
I am very not very familiar with using command line tools. However, a solution that fixed one of my earlier problems (missing .dll file) was installing a Visual C++ Redistributable, so I tried installing all of them, but that didn't help. Or is it possible to completely omit the problem by having the deformation field in another file format than .nrrd?
Does anyone know what might have gone wrong here?
Best,
Ingrid
I am trying to perform EPI unwarping in the Windows command line (CMD.EXE), but I have encountered a problem.
First, I type in:
epiunwarp --write-jacobian-fwd
epiunwarp/jacobian_fwd.nii \
inputs/b0_fwd.nii.gz inputs/b0_rev.nii.gz \
epiunwarp/b0_fwd.nii epiunwarp/b0_rev.nii epiunwarp/dfield.nrrd
This step works just fine. Then I type in:inputs/b0_fwd.nii.gz inputs/b0_rev.nii.gz \
epiunwarp/b0_fwd.nii epiunwarp/b0_rev.nii epiunwarp/dfield.nrrd
reformatx --floating inputs/b1.nii
--linear -o epiunwarp/b1.nii \
epiunwarp/b0_fwd.nii epiunwarp/dfield.nrrd
This gives me an error message: "The file/directory
epiunwarp/dfield.nrrd does not exist or cannot be read."epiunwarp/b0_fwd.nii epiunwarp/dfield.nrrd
I am sure that the file exists, so there must be some kind of problem reading the file. My operative system is Windows 7. I have tried the same thing in Cygwin (on the same computer), and there it works perfectly fine. However, I am going to do the EPI unwarping in another program (in MeVisLab, using an "External Executable Wrapper"), and I don't think that can be done via Cygwin. Therefore, I want this to work using only the Windows command line.
I am very not very familiar with using command line tools. However, a solution that fixed one of my earlier problems (missing .dll file) was installing a Visual C++ Redistributable, so I tried installing all of them, but that didn't help. Or is it possible to completely omit the problem by having the deformation field in another file format than .nrrd?
Does anyone know what might have gone wrong here?
Best,
Ingrid
Feb 18, 2018 06:02 PM | Torsten Rohlfing
RE: Trouble with reading .nrrd in Windows
Hi Ingrid -
There have recently been folks who've had similar issues because they copy-and-pasted command lines from a text editor, and in the process their "space" characters were changed to something other than ASCII space (e.g., some Unicode space). That led to failure of the command, but was virtually impossible to tell from looking at the command line, because the Unicode space and ASCII space appear exactly the same.
Can you rule out that this is happening to you? (In general, if you type your command, not paste it, then you should be okay.)
Another possible source of problems is that CMTK will generally compress Nrrd files using libz compression. Since libz is not a standard library on native Windows, it needs to be built along with CMTK (a source version of it is actually bundled with CMTK's source code.) If you wrote a file with a CMTK tool build with libz support, then a tool built without that support would not be able to read the resulting files. So if, say, you ran epiunwarp from a Cygwin build but tried to read the file with a native Windows reformatx binary. then that might fail. If you are using epiunwarp/reformatx from the same source, then you should be safe, though, since either all tools in a build have libz support, or none do.
Finally - I think you *should* actually be able to run Cygwin tools from inside MeVisLab, even on Windows. A Cygwin binary is a perfectly valid Windows binary; it simply depends on the cygwin.dll to provide Cygwin functionality. So as long as you have cygwin.dll installed (and, perhaps, in your search path) you should have no problem running Cygwin binaries from the Windows shell or any other program, just like you would a native Windows tool.
Hope this helps.
Best,
Torsten
There have recently been folks who've had similar issues because they copy-and-pasted command lines from a text editor, and in the process their "space" characters were changed to something other than ASCII space (e.g., some Unicode space). That led to failure of the command, but was virtually impossible to tell from looking at the command line, because the Unicode space and ASCII space appear exactly the same.
Can you rule out that this is happening to you? (In general, if you type your command, not paste it, then you should be okay.)
Another possible source of problems is that CMTK will generally compress Nrrd files using libz compression. Since libz is not a standard library on native Windows, it needs to be built along with CMTK (a source version of it is actually bundled with CMTK's source code.) If you wrote a file with a CMTK tool build with libz support, then a tool built without that support would not be able to read the resulting files. So if, say, you ran epiunwarp from a Cygwin build but tried to read the file with a native Windows reformatx binary. then that might fail. If you are using epiunwarp/reformatx from the same source, then you should be safe, though, since either all tools in a build have libz support, or none do.
Finally - I think you *should* actually be able to run Cygwin tools from inside MeVisLab, even on Windows. A Cygwin binary is a perfectly valid Windows binary; it simply depends on the cygwin.dll to provide Cygwin functionality. So as long as you have cygwin.dll installed (and, perhaps, in your search path) you should have no problem running Cygwin binaries from the Windows shell or any other program, just like you would a native Windows tool.
Hope this helps.
Best,
Torsten
Feb 18, 2018 06:02 PM | Torsten Rohlfing
RE: Trouble with reading .nrrd in Windows
One more thing - you might be able to get some additional
information on what's going on by using CMTK's "describe" tool to
identify the problem file, like so:
describe --verbose
epiunwarp/dfield.nrrd
Feb 20, 2018 04:02 PM | Ingrid Framås Syversen
RE: Trouble with reading .nrrd in Windows
Thank you for your answer!
No, I haven't copy+pasted anything, so that shouldn't be the problem. I have also used epiunwarp and reformatx from the same source. When trying the describe function, all I get is "File does not exist".
Thanks for the advice about running Cygwin tools in Windows. I tried running the whole EPI unwarping in the Windows command line using the Cygwin-CMTK (with Cygwin binaries added to the path), and it worked! So I think that will probably be my solution, given that I am able to modify the path in MeVisLab.
Best,
Ingrid
No, I haven't copy+pasted anything, so that shouldn't be the problem. I have also used epiunwarp and reformatx from the same source. When trying the describe function, all I get is "File does not exist".
Thanks for the advice about running Cygwin tools in Windows. I tried running the whole EPI unwarping in the Windows command line using the Cygwin-CMTK (with Cygwin binaries added to the path), and it worked! So I think that will probably be my solution, given that I am able to modify the path in MeVisLab.
Best,
Ingrid
Feb 21, 2018 06:02 AM | Torsten Rohlfing
RE: Trouble with reading .nrrd in Windows
Excellent - by the way, another benefit of using the Cygwin
binaries is that they fully support multicore CPUs. The Windows
binaries, for lack of a proper license, were built with the Express
edition of VisualStudio, and as such do not have multithreading
enabled. (That is, if you got your binaries from NITRC; if you
built your own with a full VS license, you should be able to get
multithreading also, but I am mentioning that just for
completeness.)