Skip to content

Commit e93b9b0

Browse files
committed
Merge branch 'release/v0.0.4'
2 parents 7aa09e1 + 7732ecd commit e93b9b0

File tree

5 files changed

+209
-49
lines changed

5 files changed

+209
-49
lines changed

app/containers/PipelinePage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import IconButton from '@material-ui/core/IconButton'
2626
import Tooltip from '@material-ui/core/Tooltip'
2727
import Drawer from '@material-ui/core/Drawer';
2828

29-
import { fromJS } from 'immutable';
29+
import { fromJS, isImmutable } from 'immutable';
3030

3131
import {
3232
PipelineIcon,
@@ -127,7 +127,7 @@ class PipelinePage extends Component {
127127
if (typeof key == "string") {
128128
key = key.split('.')
129129
}
130-
configuration = configuration.setIn(key, value)
130+
configuration = configuration.setIn(key, isImmutable(value) ? value : fromJS(value))
131131
}
132132

133133
this.props.pipelineVersionDirtyUpdate(

app/containers/pipeline/parts/anatomical/Registration.js

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import FormControlLabel from '@material-ui/core/FormControlLabel';
1313
import TextField from '@material-ui/core/TextField';
1414
import InputAdornment from '@material-ui/core/InputAdornment';
1515
import Switch from '@material-ui/core/Switch';
16-
16+
import InputLabel from '@material-ui/core/InputLabel';
1717
import Collapse from '@material-ui/core/Collapse';
1818

1919
import Help from 'components/Help'
@@ -28,6 +28,8 @@ class Registration extends Component {
2828
render() {
2929
const { classes, configuration, onChange } = this.props
3030

31+
const resolution = configuration.getIn("anatomical.registration.resolution".split("."))
32+
3133
return (
3234
<React.Fragment>
3335
<Help
@@ -37,15 +39,69 @@ class Registration extends Component {
3739
Optional input types: 1 one integer or float number indicating 3 same dimensions, e.g. 3 or 2.5; 2 three different integers or float numbers connected by 'x', e.g. 3x2.67x2.67. `}
3840
fullWidth
3941
>
40-
<TextField label="Resolution"
41-
name="anatomical.registration.resolution"
42-
value={configuration.getIn("anatomical.registration.resolution".split("."))}
43-
onChange={onChange}
44-
fullWidth margin="normal" variant="outlined"
45-
InputProps={{
46-
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
47-
}}
48-
/>
42+
<InputLabel>Resolution</InputLabel>
43+
{
44+
45+
resolution.size ?
46+
47+
<Grid container>
48+
<Grid item xs={4}>
49+
<TextField
50+
name="anatomical.registration.resolution.0"
51+
value={resolution.get(0)}
52+
onChange={onChange}
53+
fullWidth margin="normal" variant="outlined"
54+
InputProps={{
55+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
56+
}}
57+
/>
58+
</Grid>
59+
<Grid item xs={4}>
60+
<TextField
61+
name="anatomical.registration.resolution.1"
62+
value={resolution.get(1)}
63+
onChange={onChange}
64+
fullWidth margin="normal" variant="outlined"
65+
InputProps={{
66+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
67+
}}
68+
/>
69+
</Grid>
70+
<Grid item xs={4}>
71+
<TextField
72+
name="anatomical.registration.resolution.2"
73+
value={resolution.get(2)}
74+
onChange={onChange}
75+
fullWidth margin="normal" variant="outlined"
76+
InputProps={{
77+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
78+
}}
79+
/>
80+
</Grid>
81+
</Grid>
82+
83+
:
84+
85+
<TextField label="Resolution"
86+
name="anatomical.registration.resolution"
87+
value={resolution}
88+
onChange={function(event) {
89+
if (event.target.value.includes("x")) {
90+
let values = event.target.value.replace(/[^0-9\.x]/, '').split("x").filter(Boolean).map(parseFloat)
91+
values = [...values, ...values, ...values].slice(0, 3)
92+
onChange(
93+
[[['anatomical', 'registration', 'resolution'], values]]
94+
)
95+
} else {
96+
onChange(event)
97+
}
98+
}}
99+
fullWidth margin="normal" variant="outlined"
100+
InputProps={{
101+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
102+
}}
103+
/>
104+
}
49105
</Help>
50106

51107
<FormGroup>

app/containers/pipeline/parts/functional/TemplateRegistration.js

Lines changed: 130 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { withStyles, Typography } from '@material-ui/core';
44
import Grid from '@material-ui/core/Grid';
55
import MenuItem from '@material-ui/core/MenuItem';
66
import TextField from '@material-ui/core/TextField';
7+
import InputLabel from '@material-ui/core/InputLabel';
78
import InputAdornment from '@material-ui/core/InputAdornment';
89
import Collapse from '@material-ui/core/Collapse';
910
import Help from 'components/Help'
@@ -16,7 +17,9 @@ class TemplateRegistration extends Component {
1617

1718
render() {
1819
const { classes, configuration, onChange } = this.props
19-
20+
const functional_resolution = configuration.getIn(["functional", "template_registration", "functional_resolution"])
21+
const derivative_resolution = configuration.getIn(["functional", "template_registration", "derivative_resolution"])
22+
2023
return (
2124
<Grid container>
2225
<Grid item sm={12}>
@@ -83,15 +86,69 @@ class TemplateRegistration extends Component {
8386
Note that selecting a 1 mm or 2 mm resolution might substantially increase your RAM needs- these resolutions should be selected with caution. For most cases, 3 mm or 4 mm resolutions are suggested.`}
8487
fullWidth
8588
>
86-
<TextField label="Functional Resolution"
87-
fullWidth margin="normal" variant="outlined"
88-
name="functional.template_registration.functional_resolution"
89-
value={configuration.getIn(["functional", "template_registration", "functional_resolution"])}
90-
onChange={onChange}
91-
InputProps={{
92-
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
93-
}}
94-
/>
89+
<InputLabel>Functional Resolution</InputLabel>
90+
{
91+
92+
functional_resolution.size ?
93+
94+
<Grid container>
95+
<Grid item xs={4}>
96+
<TextField
97+
name="functional.template_registration.functional_resolution.0"
98+
value={functional_resolution.get(0)}
99+
onChange={onChange}
100+
fullWidth margin="normal" variant="outlined"
101+
InputProps={{
102+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
103+
}}
104+
/>
105+
</Grid>
106+
<Grid item xs={4}>
107+
<TextField
108+
name="functional.template_registration.functional_resolution.1"
109+
value={functional_resolution.get(1)}
110+
onChange={onChange}
111+
fullWidth margin="normal" variant="outlined"
112+
InputProps={{
113+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
114+
}}
115+
/>
116+
</Grid>
117+
<Grid item xs={4}>
118+
<TextField
119+
name="functional.template_registration.functional_resolution.2"
120+
value={functional_resolution.get(2)}
121+
onChange={onChange}
122+
fullWidth margin="normal" variant="outlined"
123+
InputProps={{
124+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
125+
}}
126+
/>
127+
</Grid>
128+
</Grid>
129+
130+
:
131+
132+
<TextField label="Resolution"
133+
name="functional.template_registration.functional_resolution"
134+
value={functional_resolution}
135+
onChange={function(event) {
136+
if (event.target.value.includes("x")) {
137+
let values = event.target.value.replace(/[^0-9\.x]/, '').split("x").filter(Boolean).map(parseFloat)
138+
values = [...values, ...values, ...values].slice(0, 3)
139+
onChange(
140+
[[['functional', 'template_registration', 'functional_resolution'], values]]
141+
)
142+
} else {
143+
onChange(event)
144+
}
145+
}}
146+
fullWidth margin="normal" variant="outlined"
147+
InputProps={{
148+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
149+
}}
150+
/>
151+
}
95152
</Help>
96153

97154
<Help
@@ -100,15 +157,69 @@ class TemplateRegistration extends Component {
100157
help={`The resolution (in mm) to which the registered derivative outputs are written into.`}
101158
fullWidth
102159
>
103-
<TextField label="Derivative Resolution"
104-
fullWidth margin="normal" variant="outlined"
105-
name="functional.template_registration.derivative_resolution"
106-
value={configuration.getIn(["functional", "template_registration", "derivative_resolution"])}
107-
onChange={onChange}
108-
InputProps={{
109-
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
110-
}}
111-
/>
160+
<InputLabel>Derivative Resolution</InputLabel>
161+
{
162+
163+
derivative_resolution.size ?
164+
165+
<Grid container>
166+
<Grid item xs={4}>
167+
<TextField
168+
name="functional.template_registration.derivative_resolution.0"
169+
value={derivative_resolution.get(0)}
170+
onChange={onChange}
171+
fullWidth margin="normal" variant="outlined"
172+
InputProps={{
173+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
174+
}}
175+
/>
176+
</Grid>
177+
<Grid item xs={4}>
178+
<TextField
179+
name="functional.template_registration.derivative_resolution.1"
180+
value={derivative_resolution.get(1)}
181+
onChange={onChange}
182+
fullWidth margin="normal" variant="outlined"
183+
InputProps={{
184+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
185+
}}
186+
/>
187+
</Grid>
188+
<Grid item xs={4}>
189+
<TextField
190+
name="functional.template_registration.derivative_resolution.2"
191+
value={derivative_resolution.get(2)}
192+
onChange={onChange}
193+
fullWidth margin="normal" variant="outlined"
194+
InputProps={{
195+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
196+
}}
197+
/>
198+
</Grid>
199+
</Grid>
200+
201+
:
202+
203+
<TextField label="Resolution"
204+
name="functional.template_registration.derivative_resolution"
205+
value={derivative_resolution}
206+
onChange={function(event) {
207+
if (event.target.value.includes("x")) {
208+
let values = event.target.value.replace(/[^0-9\.x]/, '').split("x").filter(Boolean).map(parseFloat)
209+
values = [...values, ...values, ...values].slice(0, 3)
210+
onChange(
211+
[[['functional', 'template_registration', 'derivative_resolution'], values]]
212+
)
213+
} else {
214+
onChange(event)
215+
}
216+
}}
217+
fullWidth margin="normal" variant="outlined"
218+
InputProps={{
219+
endAdornment: <InputAdornment position="end">mm</InputAdornment>,
220+
}}
221+
/>
222+
}
112223
</Help>
113224

114225
<Help

c-pac/pipeline.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -267,16 +267,13 @@ export function parse(content) {
267267
c.anatomical.skull_stripping.methods.niworkflows_ants.enabled = true
268268
}
269269

270-
c.anatomical.registration.resolution = config.resolution_for_anat.replace(/mm/g,"")
271-
if (c.anatomical.registration.resolution.includes("x")) {
272-
temp = config.resolution_for_anat.split("x")
273-
c.anatomical.registration.resolution = []
274-
275-
for (i = 0; i < 3; i++) {
276-
c.anatomical.registration.resolution.push(parseFloat(temp[i]))
277-
}
270+
if (config.resolution_for_anat.includes("x")) {
271+
c.anatomical.registration.resolution =
272+
config.resolution_for_anat.replace('mm', '')
273+
.split("x")
274+
.map(parseFloat)
278275
} else {
279-
c.anatomical.registration.resolution = []
276+
c.anatomical.registration.resolution = parseFloat(config.resolution_for_anat.replace('mm', ''))
280277
}
281278

282279
c.anatomical.registration.brain_template = config.template_brain_only_for_anat
@@ -697,14 +694,10 @@ export function dump(pipeline, version='0') {
697694
config.bet_threshold = c.anatomical.skull_stripping.methods.bet.configuration.apply_threshold
698695
config.bet_vertical_gradient = c.anatomical.skull_stripping.methods.bet.configuration.vertical_gradient
699696

700-
if (c.anatomical.registration.resolution.includes("x")) {
701-
var xind = []
702-
for(var i = 0; i < c.anatomical.registration.resolution.length; i++) {
703-
if (c.anatomical.registration.resolution[i] === "x") xind.push(i)
704-
}
705-
config.resolution_for_anat = c.anatomical.registration.resolution.slice(0, xind[0]) + "mm" + c.anatomical.registration.resolution.slice(xind[0], xind[1]) + "mm" + c.anatomical.registration.resolution.slice(xind[1]) + "mm"
706-
} else {
697+
if (typeof c.anatomical.registration.resolution === "number") {
707698
config.resolution_for_anat = c.anatomical.registration.resolution + "mm"
699+
} else {
700+
config.resolution_for_anat = c.anatomical.registration.resolution.join('mmx') + 'mm'
708701
}
709702

710703
config.niworkflows_ants_template_path = c.anatomical.skull_stripping.methods.niworkflows_ants.ants_templates.niworkflows_ants_template_path
@@ -1013,7 +1006,7 @@ export function dump(pipeline, version='0') {
10131006

10141007
config.peer_gsr = c.derivatives.pypeer.gsr
10151008
config.peer_scrub = c.derivatives.pypeer.scrub.enabled
1016-
config.peer_scrub_thresh = c.derivative.pypeer.scrub.threshold
1009+
config.peer_scrub_thresh = c.derivatives.pypeer.scrub.threshold
10171010

10181011
config.memoryAllocatedForDegreeCentrality = 3.0
10191012

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Configurable Pipeline for the Analysis of Connectomes",
44
"homepage": "https://github.com/FCP-INDI/C-PAC_GUI",
55
"productName": "C-PAC",
6-
"version": "0.0.3",
6+
"version": "0.0.4",
77
"scripts": {
88
"build-dll": "cross-env NODE_ENV=development node --trace-warnings -r @babel/register ./node_modules/webpack/bin/webpack --mode development --config config/webpack.config.renderer.dev.dll.js --colors",
99
"build:electron": "cross-env node --trace-warnings -r @babel/register ./node_modules/webpack/bin/webpack --mode production --config config/webpack.config.main.prod.js --colors",

0 commit comments

Comments
 (0)