Skip to content

Commit 3da8ac7

Browse files
committed
dcm2nii: fix fcomment & add tests
1 parent 5bad1eb commit 3da8ac7

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

amypet/dcm2nii.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
log = logging.getLogger(__name__)
1919

2020

21-
def run(dcmpth, fcomment="", timestamp=True):
21+
def run(dcmpth, fcomment="converted-from-DICOM_", timestamp=True):
2222
dcmpth = Path(dcmpth)
2323
assert dcmpth.is_dir()
2424
log.info("convert")
25-
res = nimpa.dcm2nii(dcmpth, fcomment=fcomment, timestamp=timestamp)
25+
res = nimpa.dcm2nii(dcmpth, fprefix=fcomment, timestamp=timestamp)
2626
log.debug("output file:%s", res)
2727
return res

tests/test_dcm2nii.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
5+
6+
@pytest.mark.timeout(30 * 60) # 30m
7+
def test_dcm2nii(datain):
8+
dcmpth = Path(datain['mumapDCM'])
9+
assert not list(dcmpth.glob('test_dcm2nii_*.nii*'))
10+
dcm2nii = pytest.importorskip("amypet.dcm2nii")
11+
dcm2nii.run(datain['mumapDCM'], fcomment="test_dcm2nii_")
12+
assert list(dcmpth.glob('test_dcm2nii_*.nii*'))
13+
for f in dcmpth.glob('test_dcm2nii_*.nii*'):
14+
f.unlink()

0 commit comments

Comments
 (0)