Skip to content

Conversation

@casperdcl
Copy link
Member

@casperdcl casperdcl commented Oct 31, 2021

outdated test script
from pathlib import Path
from subprocess import check_output
from time import time

import dicom2nifti
from miutil import imio, plot
from niftypet.nimpa import resources as rs

dir_in = './umap'
#dcm2niix = str(Path("~/NiftyPET_tools/dcm2niix/bin/dcm2niix").expanduser())
dcm2niix = rs.DCM2NIIX

def clean_dir(pth):
    if pth.is_dir():
        [i.unlink() for i in pth.glob('*.*')]
        pth.rmdir()
    pth.mkdir()
    return str(pth)

dir_out = clean_dir(Path(dir_in + '-dcm2niix'))
tic = time()
check_output([dcm2niix, '-f', 'test', '-o', dir_out, dir_in])
print(f"{time()-tic:.3f} elapsed (dcm2niix)")

dir_out = clean_dir(Path(dir_in + '-dicom2nifti'))
tic = time()
dicom2nifti.convert_directory(dir_in, dir_out)
print(f"{time()-tic:.3f} elapsed (dicom2nifti)")

pth_in = Path(dir_in)
plot.imscroll({i: imio.imread(i) for i in pth_in.parent.glob(pth_in.stem + '-*/*.nii*')})
plot.show()

caveat: it's ~5x slower than dcm2niix (icometrix/dicom2nifti#102)


@casperdcl casperdcl self-assigned this Oct 31, 2021
@casperdcl casperdcl requested a review from pjmark October 31, 2021 18:15
@casperdcl casperdcl added enhancement New feature or request framework labels Oct 31, 2021
@codecov
Copy link

codecov bot commented Oct 31, 2021

Codecov Report

Merging #24 (70da069) into devel (7099d6e) will decrease coverage by 0.04%.
The diff coverage is 3.33%.

Impacted file tree graph

@@           Coverage Diff            @@
##           devel     #24      +/-   ##
========================================
- Coverage   9.56%   9.52%   -0.05%     
========================================
  Files          9       9              
  Lines       2059    2047      -12     
========================================
- Hits         197     195       -2     
+ Misses      1862    1852      -10     
Impacted Files Coverage Δ
niftypet/nimpa/prc/imio.py 5.33% <0.00%> (-0.10%) ⬇️
niftypet/nimpa/prc/prc.py 5.66% <25.00%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7099d6e...70da069. Read the comment docs.

@casperdcl casperdcl linked an issue Jan 16, 2022 that may be closed by this pull request
2 tasks
@casperdcl casperdcl changed the title dcm2niix => dicom2nifti use external (py)dcm2niix package Jan 16, 2022
@casperdcl casperdcl merged commit ff0b7e3 into devel Jan 16, 2022
@casperdcl casperdcl deleted the dicom2nifti branch January 16, 2022 18:14
@casperdcl casperdcl mentioned this pull request Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

move dcm2niix to separate package

2 participants