Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to convolve all non fmriprep predictors. #588

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 24 additions & 2 deletions neuroscout/frontend/src/Builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,21 @@ export default class AnalysisBuilder extends React.Component<BuilderProps & Rout
} else {
this.updateState('analysis', true)(analysis);
}
this.setActiveTabs(analysis);
return Promise.resolve(analysis);
};

setActiveTabs = (analysis: Analysis) => {
if (analysis.contrasts.length) {
this.setState({
transformationsActive: true,
contrastsActive: true,
hrfActive: true,
reviewActive: true
});
}
}

confirmSubmission = (build: boolean): void => {
if (!this.submitEnabled()) return;
const { saveAnalysis } = this;
Expand Down Expand Up @@ -733,7 +745,7 @@ export default class AnalysisBuilder extends React.Component<BuilderProps & Rout
});
};

updatePredictorState = (value: any, filteredPredictors: Predictor[], hrf: boolean = false) => {
updatePredictorState = (value: Predictor[], filteredPredictors: Predictor[], hrf: boolean = false) => {
let stateUpdate: any = {};
let newAnalysis = { ...this.state.analysis };
let filteredIds = filteredPredictors.map(x => x.id);
Expand Down Expand Up @@ -981,6 +993,12 @@ export default class AnalysisBuilder extends React.Component<BuilderProps & Rout
);
}

addAllHRF = () => {
// create HRF convolution transform for all variables that aren't from fmriprep
let predictors = this.state.selectedPredictors.filter(x => x.source !== 'fmriprep');
this.updatePredictorState(predictors, this.state.selectedPredictors, true);
}

componentDidUpdate(prevProps, prevState) {
// we really only need a valid JWT when creating the analysis
if (editableStatus.includes(this.state.analysis.status)) {
Expand Down Expand Up @@ -1035,7 +1053,6 @@ export default class AnalysisBuilder extends React.Component<BuilderProps & Rout
this.postTabChange(activeTab);
}
return (

<div className="App">
<Prompt
when={unsavedChanges}
Expand Down Expand Up @@ -1107,6 +1124,11 @@ export default class AnalysisBuilder extends React.Component<BuilderProps & Rout
updateSelection={this.updateHRFPredictorState}
/>
<br/>
<p>
<Button type="default" onClick={this.addAllHRF}>
<Icon type="plus" /> Select All Non-Confounds
</Button>
</p>
{this.navButtons()}
<br/>
</TabPane>}
Expand Down