-
-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
itkantsReadWriteTransform fails if filepath contains .mat, .txt, etc. anywhere #567
Comments
|
thanks - any chance you can make a pull request on github?
that's the easiest way to manage and check ( automatically via travis ) +
you get credit for the work, at least via
a documented contribution to ants.
brian
…On Thu, Apr 12, 2018 at 4:03 PM, CGSchwarzMayo ***@***.***> wrote:
We ran into a confusing behavior where antsApplyTransforms would sometimes
fail to read transform files, despite the file clearly existing with
sufficient permissions. Upon some testing, we discovered that these same
files could be read if we provided the relative, but not absolute,
filepaths. The pattern turned out to be that the filepaths in question
contained '.mat' inside the directory name. Specifically, we had an SGE
queue named matlab.q, and /tmp files created for it were in a pattern of
/tmp/*.matlab.q.*/.
I found that itkantsReadWriteTransform.h checks for any of these strings
anywhere in the filepath: .h5, .hdf5, .hdf4, .mat, .txt, .xfm. If any of
these is detected anywhere in the (absolute, if given) path name of a
.nii.gz transform file, it will try to read it using itk affine transform
readers. These then fail, and an error is thrown, rather than attempting to
use the .nii transform reading functions.
The attached patch changes this logic so that the string matching is
performed only on the extension rather than the entire filepath. This could
certainly be implemented in many ways, but mine copied the logic from
itkTxtTransformIO.hxx using itksys::SystemTools::GetFilenameLastExtension.
itksys::SystemTools is already used elsewhere in
itkantsReadWriteTransform.h, so this does not introduce an extra dependency.
antsFilepathExtensionFix.txt
<https://github.com/ANTsX/ANTs/files/1904770/antsFilepathExtensionFix.txt>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#567>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATyfqWDXRKOctDq5Ttkw_iFGEatX94Tks5tn7MggaJpZM4TSaK4>
.
|
You bet! I'm new to github but will figure it out. |
CGSchwarzMayo
added a commit
to CGSchwarzMayo/ANTs
that referenced
this issue
Apr 12, 2018
Fixes ANTsX#567 upstream
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We ran into a confusing behavior where antsApplyTransforms would sometimes fail to read transform files, despite the file clearly existing with sufficient permissions. Upon some testing, we discovered that these same files could be read if we provided the relative, but not absolute, filepaths. The pattern turned out to be that the filepaths in question contained '.mat' inside the directory name. Specifically, we had an SGE queue named matlab.q, and /tmp files created for it were in a pattern of /tmp/.matlab.q./.
I found that itkantsReadWriteTransform.h checks for any of these strings anywhere in the filepath: .h5, .hdf5, .hdf4, .mat, .txt, .xfm. If any of these is detected anywhere in the (absolute, if given) path name of a .nii.gz transform file, it will try to read it using itk affine transform readers. These then fail, and an error is thrown, rather than attempting to use the .nii transform reading functions.
The attached patch changes this logic so that the string matching is performed only on the extension rather than the entire filepath. This could certainly be implemented in many ways, but mine copied the logic from itkTxtTransformIO.hxx using itksys::SystemTools::GetFilenameLastExtension. itksys::SystemTools is already used elsewhere in itkantsReadWriteTransform.h, so this does not introduce an extra dependency.
antsFilepathExtensionFix.txt
The text was updated successfully, but these errors were encountered: