Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dlevitas committed Oct 2, 2023
1 parent a8c139f commit 432307f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 13 deletions.
19 changes: 12 additions & 7 deletions ui/src/Objects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
</el-form-item>
</div>

<div v-if="so._type.startsWith('fmap/')" class="border-top">
<div v-if="so._type.startsWith('fmap/') || so._type === 'perf/m0scan'" class="border-top">
<br>
<el-form-item label="IntendedFor">
<el-select v-model="so.IntendedFor" multiple placeholder="Select Object" style="width: 100%" @change="update(so)">
Expand Down Expand Up @@ -360,7 +360,7 @@
if(!o) return;
this.$emit("updateObject", o);
},
isValid(cb: (err?: string)=>void) {
this.$emit("mapObjects");
this.validateAll();
Expand Down Expand Up @@ -470,13 +470,18 @@
}
}
if(o._type.startsWith("fmap/")) {
if(!o.IntendedFor) o.IntendedFor = []; //TODO can't think of a better place to do this
if(o._type.startsWith("fmap/") || o._type === "perf/m0scan") {
if(!o.IntendedFor) o.IntendedFor = [];
if(o.IntendedFor.length == 0) {
let warningMessage = "It is recommended that field map (fmap) images have IntendedFor set to at least 1 object. This is necessary if you plan on using processing BIDS-apps such as fMRIPrep"
if (!o.validationWarnings.includes(warningMessage)) {
o.validationWarnings.push(warningMessage);
if(o._type.startsWith("fmap/")) {
o.validationWarnings.push("It is recommended that field map (fmap) images have IntendedFor set to at least 1 series ID. This is necessary if you plan on using processing BIDS-apps such as fMRIPrep");
} else if (o.type === "perf/m0scan") {
o.validationErrors.push("It is required that perfusion m0scan images have IntendedFor set to at least 1 series ID.");
}
// let warningMessage = "It is recommended that these images have IntendedFor set to at least 1 object. This is necessary if you plan on using processing BIDS-apps such as fMRIPrep"
// if (!o.validationWarnings.includes(warningMessage)) {
// o.validationWarnings.push(warningMessage);
// }
}
//Ensure other fmap series aren't included in the IntendedFor mapping
Expand Down
16 changes: 10 additions & 6 deletions ui/src/SeriesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</p> -->
</div>

<div v-if="ss.type && ss.type.startsWith('fmap/')">
<div v-if="ss.type && (ss.type.startsWith('fmap/') || ss.type === 'perf/m0scan')">
<el-form-item label="IntendedFor">
<el-select v-model="ss.IntendedFor" required multiple filterable
placeholder="Please select Series" size="small"
Expand All @@ -92,7 +92,7 @@
</el-option>
</el-select>
<p style="margin-top: 0">
<small>* <b>Recommended</b>: select Series that this field map should be applied to. Helpful is planning on using BIDS-apps for processing (e.g., fMRIPrep).</small>
<small>* <b>Recommended (Required if perf/m0scan)</b>: select Series that this sequence should be applied to.</small>
</p>
</el-form-item>
</div>
Expand Down Expand Up @@ -310,15 +310,19 @@ export default defineComponent({
}
}
if(s.type.startsWith("fmap/")) {
if(s.type.startsWith("fmap/") || s.type === "perf/m0scan") {
if(!s.IntendedFor) s.IntendedFor = [];
if(s.IntendedFor.length == 0) {
s.validationWarnings.push("It is recommended that field map (fmap) images have IntendedFor set to at least 1 series ID. This is necessary if you plan on using processing BIDS-apps such as fMRIPrep");
if(s.type.startsWith("fmap/")) {
s.validationWarnings.push("It is recommended that field map (fmap) images have IntendedFor set to at least 1 series ID. This is necessary if you plan on using processing BIDS-apps such as fMRIPrep");
} else if (s.type === "perf/m0scan") {
s.validationErrors.push("It is required that perfusion m0scan images have IntendedFor set to at least 1 series ID.");
}
}
//Ensure other fmap series aren't included in the IntendedFor mapping
//Ensure other fmap or perf/m0scan series aren't included in the IntendedFor mapping
if(s.IntendedFor.length > 0) {
s.IntendedFor.forEach(i=>{
if(this.ezbids.series[i].type.startsWith("fmap/")) {
if(this.ezbids.series[i].type.startsWith("fmap/") || this.ezbids.series[i].type === "perf/m0scan") {
s.validationErrors.push("The selected series (#"+i+") appears to be a field map (fmap), which isn't allowed in the IntendedFor mapping. Please remove this series, or, if it isn't a field map, please correct it.")
}
})
Expand Down
25 changes: 25 additions & 0 deletions ui/src/libUnsafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,31 @@ export function setIntendedFor($root:IEzbids) {
});
}
}
// if (obj._type.startsWith("fmap/") || obj._type === "perf/m0scan") {
// if (!obj.IntendedFor) {
// Object.assign(obj, {IntendedFor: []})
// }

// let correspindingSeriesIntendedFor = $root.series[obj.series_idx].IntendedFor
// if (correspindingSeriesIntendedFor !== undefined && correspindingSeriesIntendedFor !== null) {
// correspindingSeriesIntendedFor.forEach((i:number) => {
// let IntendedForIDs = section.filter(o=>o.series_idx === i && o._type !== "func/events").map(o=>o.idx)
// if (obj.IntendedFor !== undefined) {
// IntendedForIDs.forEach((IntendedForID:number) => {
// if (!obj.IntendedFor?.includes(IntendedForID)) {
// obj.IntendedFor = obj.IntendedFor?.concat(IntendedForIDs)
// }

// let IntendedForObj = sesGroup.objects.filter(e=>e.idx === IntendedForID)[0]
// console.log(IntendedForObj)
// if (IntendedForObj._exclude || IntendedForObj._type === "exclude") {
// obj.IntendedFor = obj.IntendedFor?.filter(e=>e === IntendedForID)
// }
// })
// }
// });
// }
// }

// check B0FieldIdentifier and B0FieldSource information
if (obj._type && !obj._type.includes('exclude') && !obj._type.includes('events')) {
Expand Down

0 comments on commit 432307f

Please sign in to comment.