+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

SPM Dicom Convert in python (Ipython/ Nipype)

发布于2020-10-30 21:44     阅读(79)     评论(0)     点赞(27)     收藏(5)


0

1

2

3

4

5

6

7

8

I am new to python or more specifically ipython. I have been running through the steps to run what should be a very simple Dicom Conversion in a statistical package called SPM for an MRI image file as described by NiPype. I can't get it to run and was wondering what I was doing wrong. I am not getting an error message, instead, there is no file change or output. It just hangs. Does anyone have any idea what I might be doing wrong? It's likely that I am missing something very simple here (sorry :(

import os
from pylab import *
from glob import glob
from nipype.interfaces.matlab import MatlabCommand as mlab
mlab.set_default_paths('/home/orkney_01/s1252042/matlab/spm8')
from nipype.interfaces.spm.utils import DicomImport as di

os.chdir('/sdata/images/projects/ASD_MM/1/datafiles/restingstate_files')
filename = "reststate_directories.txt"
restingstate_files_list = [line.strip() for line in open(filename)]

for x in restingstate_files_list:
    os.chdir( x )
    y = glob('*.dcm')
    conversion = di(in_files = y))
    print(res.outputs)

解决方案


You are creating a DicomImport interface, but you are not actually running it. You should have res = di.run().

Also, you are best to tell the interface where to run using di.base_dir = '/some/path' before running.

Finally, you may also want to print the contents of restingstate_files_list to check you are finding the DICOM directories correctly.

0

1

2

3

4

5

6

7



所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接: https://www.pythonheidong.com/blog/article/609629/573807140960fd2dd243/

来源: python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

27 0
收藏该文
已收藏

评论内容:(最多支持255个字符)