函数适用于相对路径输入,但不适用于绝对路径输入
存在一个属于软件包 (MRICro) 一部分的功能,它被称为“dcm2nii”。
当使用相对路径作为输出目录时,该函数运行得很好。
但是,当使用完全相同文件夹的绝对路径时,该功能就会崩溃。
示例(绝对路径):
dcm2nii -o /net/user1/project_name/Data/2011_01_10_SVD1/Processed/3_fMRI_rest E2538S3I00*
示例(相对路径):
dcm2nii -o ../Processed/3_fMRI_rest E2538S3I00*
使用输出文件夹的绝对路径时出现的示例错误消息(最后一行提示无法创建输出文件):
Validating 52 potential DICOM images.
Found 52 DICOM images.
Converting 52/52 2
E2538S3I0001.MR.dcm->20110110_112950E2538S3I0001MRFPSD1F29OCT2010RCs003a1001.nii
GZip 20110110_112950E2538S3I0001MRFPSD1F29OCT2010RCs003a1001.nii
unable to create /net/user1/project_name/Data/2011_01_10_SVD1/Processed/3_fMRI_rest/20110110_112950E2538S3I0001MRFPSD1F29OCT2010RCs003a1001.nii.gz
不知道是否是这个问题造成的对我来说,在 Linux/bash 中做错了什么,或者由于该函数实际上有错误。
但是,任何意见都会受到赞赏。
在更一般的层面上,我正在寻找任何可预见的原因来解释为什么函数能够使用相对文件夹路径而不是绝对文件夹路径(前提是它们解析到同一位置)。
编辑: pwd 给出: /net/user1/project_name/Data/2011_01_10_SVD1/3_fMRI_rest
There exists a function that is part of a software package (MRICro), and it is called 'dcm2nii.'
When a relative path is used as the output directory, the function works perfectly well.
But, when the absolute path to the exact same folder is used, the function breaks down.
Example (absolute path):
dcm2nii -o /net/user1/project_name/Data/2011_01_10_SVD1/Processed/3_fMRI_rest E2538S3I00*
Example (relative path):
dcm2nii -o ../Processed/3_fMRI_rest E2538S3I00*
Sample error message that occurs when using the absolute path for the output folder (the last line suggests that the output file can not be created):
Validating 52 potential DICOM images.
Found 52 DICOM images.
Converting 52/52 2
E2538S3I0001.MR.dcm->20110110_112950E2538S3I0001MRFPSD1F29OCT2010RCs003a1001.nii
GZip 20110110_112950E2538S3I0001MRFPSD1F29OCT2010RCs003a1001.nii
unable to create /net/user1/project_name/Data/2011_01_10_SVD1/Processed/3_fMRI_rest/20110110_112950E2538S3I0001MRFPSD1F29OCT2010RCs003a1001.nii.gz
I do not know if this problem is due to me doing something wrong in Linux/bash or due to the function actually having a mistake.
But, any input is appreciated.
On a more general level, I am looking for any foreseeable reason for why a function would be able to use a relative folder path and not an absolute one (provided that they resolve to the same location).
EDIT: pwd gives:
/net/user1/project_name/Data/2011_01_10_SVD1/3_fMRI_rest
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我们告诉您问题的原因之前,您确实必须向我们展示代码,但是您描述的行为是可能的
这是一个不良实践的示例,但请考虑以下内容
you would really have to show us the code before we can tell you what the cause of the problem is, however the behaviour you described is possible
This is an example of poor practice but consider the following
这似乎是某种错误..我遇到了同样的问题。如果我尝试对主文件夹中的数据执行此命令,我会收到相同的错误。
但是,如果我将数据移动到不涉及任何扩展的路径,即“/tmp/data”,则程序执行正常。
This appears to be a bug of some kind.. I am experiencing the same issue. If I try to execute this command on data in my home folder, I get the same error.
However, if I move my data to a path that doesn't involve any expansion, i.e. ''/tmp/data'', the program executes fine.