Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Levitas committed Nov 3, 2023
1 parent e2a4a91 commit 0af4107
Showing 1 changed file with 0 additions and 86 deletions.
86 changes: 0 additions & 86 deletions ui/src/libUnsafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,92 +450,6 @@ export function setRun($root:IEzbids) {
})
}

// export function setRun($root:IEzbids) { // REFERENCE
// // Set run entity label for all objects, if appropriate.
// // Applied on the Dataset Review page.

// // Loop through subjects
// $root._organized.forEach((subGroup:OrganizedSubject) => {
// // Loop through sessions
// subGroup.sess.forEach((sesGroup:OrganizedSession) => {
// sesGroup.objects.forEach((obj:IObject) => {

// // leave two entity labels out for now: part and run. The part entity could have a pairing (mag/phase or real/imag), and we're interested in the run entity
// let targetEntities = Object.fromEntries(Object.entries(obj._entities).filter(([key])=>key !== "part" && key !== "run" && key !== "echo"))

// let initialGrouping = sesGroup.objects.filter(e=>e._type !== "exclude" &&
// !e._exclude &&
// e._type === obj._type &&
// e._type !== "func/events" && // let users specify the run number for func/events files
// deepEqual(Object.fromEntries(Object.entries(e._entities).filter(([key])=>key !== "part" && key !== "run" && key !== "echo")), targetEntities)
// )
// // console.log(initialGrouping)

// if (initialGrouping.length) {
// // Sort this new array by idx (i.e. order in which the sequences were collected in the scanner)
// initialGrouping.sort((a, b) => a.idx - b.idx)

// let setRun = false
// if (initialGrouping.length > 1) {
// setRun = true
// // } else if (initialGrouping.length === 1 && (initialGrouping[0]._type.includes("anat") || initialGrouping[0]._type.includes("func"))) { // might need to add conditional for not having func/events
// } else if (initialGrouping.length === 1 && (initialGrouping[0]._type.includes("func"))) { // might need to add conditional for not having func/events
// setRun = true
// }

// if (setRun) {
// let run = 1
// initialGrouping.forEach((o:IObject) => {
// if (o._entities.part && ["", "mag", "real"].includes(o._entities.part)) {
// o._entities.run = run.toString()
// o.entities.run = o._entities.run
// run++
// } else if (o._entities.part && !["", "mag", "real"].includes(o._entities.part)) {
// if (o._entities.part === "phase") {
// let correspondingFuncMag = initialGrouping.filter(e=>e._entities.part === "mag" &&
// ((e.idx === o.idx - 1 && e._type === "func/bold") || (e.idx === o.idx - 2 && e._type === "func/bold"))
// )

// if (!correspondingFuncMag.length) {
// o._exclude = true
// o.exclude = true
// o.validationWarnings = ["There is no corresponding func/bold (part-mag) sequence, therefore this sequence will be excluded from BIDS conversion"]
// } else {
// o._entities.run = correspondingFuncMag[0]._entities.run
// o.entities.run = o._entities.run
// }
// } else if (o._entities.part === "imag") {
// let correspondingFuncReal = initialGrouping.filter(e=>e._entities.part === "real" &&
// ((e.idx === o.idx - 1 && e._type === "func/bold") || (e.idx === o.idx - 2 && e._type === "func/bold"))
// )

// if (!correspondingFuncReal.length) {
// o._exclude = true
// o.exclude = true
// o.validationWarnings = ["There is no corresponding func/bold (part-real) sequence, therefore this sequence will be excluded from BIDS conversion"]
// } else {
// o._entities.run = correspondingFuncReal[0]._entities.run
// o.entities.run = o._entities.run
// }
// }
// } else {
// o._entities.run = run.toString()
// o.entities.run = o._entities.run
// run++
// }
// })
// } else {
// initialGrouping.forEach((o:IObject) => {
// o._entities.run = ""
// o.entities.run = o._entities.run
// })
// }
// }
// })
// })
// })
// }

export function setIntendedFor($root:IEzbids) {
// Apply fmap intendedFor mapping, based on user specifications on Series page.

Expand Down

0 comments on commit 0af4107

Please sign in to comment.