forked from NIST-MNI/nist_mni_pipelines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iplConcat.py
81 lines (57 loc) · 2.3 KB
/
iplConcat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @author Daniel
# @date 10/07/2011
version = '1.0'
#
# Atlas registration
#
from iplGeneral import *
from ipl.minc_tools import mincTools,mincError
# Run preprocessing using patient info
# - Function to read info from the pipeline patient
# - pipeline_version is employed to select the correct version of the pipeline
def pipeline_concat(patient, tp):
if os.path.exists(patient[tp].nl_xfm):
print ' -- pipeline_concat already done!'
###
with mincTools() as minc:
# create QC images
atlas_outline = patient.modeldir + os.sep + patient.modelname + '_outline.mnc'
if not os.path.exists(patient[tp].qc_jpg['nl_t1']):
minc.resample_smooth(patient[tp].stx2_mnc['t1'],minc.tmp('nl_stx_t1.mnc'),transform=patient[tp].nl_xfm)
minc.qc(
minc.tmp('nl_stx_t1.mnc'),
patient[tp].qc_jpg['nl_t1'],
title=patient[tp].qc_title,
image_range=[0, 120],
mask=atlas_outline,
big=True,
clamp=True,
)
###
return True
concat_v10(patient, tp) # beast by simon fristed
def concat_v10(patient, tp):
with mincTools() as minc:
tmp_xfm = minc.tmp('tmp_concat.xfm')
minc.xfmconcat([patient[tp].lng_xfm['t1'], patient.nl_xfm] , tmp_xfm)
examplegrid = patient.nl_xfm[:-4] + '_grid_0.mnc'
minc.xfm_normalize(tmp_xfm, examplegrid, patient[tp].nl_xfm, exact=True)
# create QC images
atlas_outline = patient.modeldir + os.sep + patient.modelname + '_outline.mnc'
minc.resample_smooth(patient[tp].stx_mnc['t1'],minc.tmp('nl_stx_t1.mnc'),transform=patient[tp].nl_xfm)
minc.qc(
minc.tmp('nl_stx_t1.mnc'),
patient[tp].qc_jpg['nl_t1'],
title=patient[tp].qc_title,
image_range=[0, 120],
mask=atlas_outline,
big=True,
clamp=True,
)
if __name__ == '__main__':
# Concat not very useful in stand-alone i guess
pass
# kate: space-indent on; indent-width 4; indent-mode python;replace-tabs on;word-wrap-column 80;show-tabs on