From fbacdcac040c132b169c661899aacadc98e21495 Mon Sep 17 00:00:00 2001 From: neurolabusc Date: Sun, 28 Apr 2024 13:26:58 -0400 Subject: [PATCH] Port improvements from webworker branch --- brainchop.js | 63 ++++++++++++-------- bwlabels.js | 15 +++-- main.js | 36 ++++++----- public/models/model18cls/colormap.json | 6 ++ public/models/model20chan3cls/colormap.json | 6 ++ public/models/model21_104class/colormap.json | 6 ++ public/models/model30chan18cls/colormap.json | 6 ++ public/models/model30chan50cls/colormap.json | 6 ++ public/models/model5_gw_ae/colormap.json | 6 ++ public/models/model5_gw_ae/colormap3.json | 6 ++ 10 files changed, 108 insertions(+), 48 deletions(-) create mode 100644 public/models/model18cls/colormap.json create mode 100644 public/models/model20chan3cls/colormap.json create mode 100644 public/models/model21_104class/colormap.json create mode 100644 public/models/model30chan18cls/colormap.json create mode 100644 public/models/model30chan50cls/colormap.json create mode 100644 public/models/model5_gw_ae/colormap.json create mode 100644 public/models/model5_gw_ae/colormap3.json diff --git a/brainchop.js b/brainchop.js index f3d150a..2c27852 100644 --- a/brainchop.js +++ b/brainchop.js @@ -3,7 +3,7 @@ import { BWLabeler } from './bwlabels.js' export { runInference, inferenceModelsList, brainChopOpts } const brainChopOpts = { - // General settings for input shape [batchSize, batch_D, batch_H, batch_W, numOfChan] + // General settings for input shape [batchSize, batch_D, batch_H, batch_W, numOfChan] batchSize: 1, // How many batches are used during each inference iteration numOfChan: 1, // num of channel of the input shape isColorEnable: true, // If false, grey scale will enabled @@ -30,13 +30,14 @@ const inferenceModelsList = [ modelName: '\u26A1 Tissue GWM (light)', labelsPath: './models/model5_gw_ae/labels.json', colorsPath: './models/model5_gw_ae/colorLUT.json', + colormapPath: './models/model5_gw_ae/colormap3.json', preModelId: null, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference numOverlapBatches: 0, // Number of extra overlap batches for inference enableTranspose: true, // Keras and tfjs input orientation may need a tranposing step to be matched enableCrop: true, // For speed-up inference, crop brain from background before feeding to inference model to lower memory use. - cropPadding: 2, // Padding size add to cropped brain + cropPadding: 18, // Padding size add to cropped brain autoThreshold: 0, // Threshold between 0 and 1, given no preModel and tensor is normalized either min-max or by quantiles. Will remove noisy voxels around brain enableQuantileNorm: false, // Some models needs Quantile Normaliztion. filterOutWithPreMask: false, // Can be used to multiply final output with premodel output mask to crean noisy areas @@ -54,6 +55,7 @@ const inferenceModelsList = [ modelName: '\u{1F52A} Tissue GWM (High Acc)', labelsPath: './models/model20chan3cls/labels.json', colorsPath: './models/model20chan3cls/colorLUT.json', + colormapPath: './models/model20chan3cls/colormap.json', preModelId: null, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -79,6 +81,7 @@ const inferenceModelsList = [ modelName: '\u{1F52A} Tissue GWM (High Acc, Low Mem)', labelsPath: './models/model20chan3cls/labels.json', colorsPath: './models/model20chan3cls/colorLUT.json', + colormapPath: './models/model20chan3cls/colormap.json', preModelId: null, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -104,6 +107,7 @@ const inferenceModelsList = [ modelName: '\u{1FA93} Subcortical + GWM (High Mem, Fast)', labelsPath: './models/model30chan18cls/labels.json', colorsPath: './models/model30chan18cls/colorLUT.json', + colormapPath: './models/model30chan18cls/colormap.json', preModelId: null, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -129,6 +133,7 @@ const inferenceModelsList = [ modelName: '\u{1FA93} Subcortical + GWM (Low Mem, Slow)', labelsPath: './models/model30chan18cls/labels.json', colorsPath: './models/model30chan18cls/colorLUT.json', + colormapPath: './models/model30chan18cls/colormap.json', preModelId: null, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -154,6 +159,7 @@ const inferenceModelsList = [ modelName: '\u{1FA93} Subcortical + GWM (Low Mem, Faster)', labelsPath: './models/model18cls/labels.json', colorsPath: './models/model18cls/colorLUT.json', + colormapPath: './models/model18cls/colormap.json', preModelId: null, // model run first e.g. Brain_Extraction { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -179,6 +185,7 @@ const inferenceModelsList = [ modelName: '\u{1F52A}\u{1FA93} Subcortical + GWM (Failsafe, Less Acc)', labelsPath: './models/model30chan18cls/labels.json', colorsPath: './models/model30chan18cls/colorLUT.json', + colormapPath: './models/model30chan18cls/colormap.json', preModelId: 1, // model run first e.g. Brain_Extraction { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -204,6 +211,7 @@ const inferenceModelsList = [ modelName: '\u{1F52A} Aparc+Aseg 50 (High Mem, Fast)', labelsPath: './models/model30chan50cls/labels.json', colorsPath: './models/model30chan50cls/colorLUT.json', + colormapPath: './models/model30chan50cls/colormap.json', preModelId: 1, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -229,6 +237,7 @@ const inferenceModelsList = [ modelName: '\u{1F52A} Aparc+Aseg 50 (Low Mem, Slow)', labelsPath: './models/model30chan50cls/labels.json', colorsPath: './models/model30chan50cls/colorLUT.json', + colormapPath: './models/model30chan50cls/colormap.json', preModelId: 1, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -247,6 +256,7 @@ const inferenceModelsList = [ description: 'This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time.' }, + // './models/model5_gw_ae/colorLUT.json', { id: 10, type: 'Brain_Extraction', @@ -260,7 +270,7 @@ const inferenceModelsList = [ numOverlapBatches: 0, // Number of extra overlap batches for inference enableTranspose: true, // Keras and tfjs input orientation may need a tranposing step to be matched enableCrop: true, // For speed-up inference, crop brain from background before feeding to inference model to lower memory use. - cropPadding: 2, // Padding size add to cropped brain + cropPadding: 18, // Padding size add to cropped brain autoThreshold: 0, // Threshold between 0 and 1, given no preModel and tensor is normalized either min-max or by quantiles. Will remove noisy voxels around brain enableQuantileNorm: false, // Some models needs Quantile Normaliztion. filterOutWithPreMask: false, // Can be used to multiply final output with premodel output mask to crean noisy areas @@ -278,13 +288,13 @@ const inferenceModelsList = [ modelName: '\u{1F52A} Extract the Brain (High Acc, Slow)', labelsPath: null, colorsPath: null, - preModelId: 1, // Model run first e.g. crop the brain { null, 1, 2, .. } + preModelId: null, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference numOverlapBatches: 0, // Number of extra overlap batches for inference enableTranspose: true, // Keras and tfjs input orientation may need a tranposing step to be matched enableCrop: true, // For speed-up inference, crop brain from background before feeding to inference model to lower memory use. - cropPadding: 2, // Padding size add to cropped brain + cropPadding: 0, // Padding size add to cropped brain autoThreshold: 0, // Threshold between 0 and 1, given no preModel and tensor is normalized either min-max or by quantiles. Will remove noisy voxels around brain enableQuantileNorm: false, // Some models needs Quantile Normaliztion. filterOutWithPreMask: false, // Can be used to multiply final output with premodel output mask to crean noisy areas @@ -303,13 +313,14 @@ const inferenceModelsList = [ modelName: '\u26A1 Brain Mask (FAST)', labelsPath: null, colorsPath: null, + colormapPath: './models/model5_gw_ae/colormap.json', preModelId: null, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference numOverlapBatches: 0, // Number of extra overlap batches for inference enableTranspose: true, // Keras and tfjs input orientation may need a tranposing step to be matched enableCrop: true, // For speed-up inference, crop brain from background before feeding to inference model to lower memory use. - cropPadding: 2, // Padding size add to cropped brain + cropPadding: 17, // Padding size add to cropped brain autoThreshold: 0, // Threshold between 0 and 1, given no preModel and tensor is normalized either min-max or by quantiles. Will remove noisy voxels around brain enableQuantileNorm: false, // Some models needs Quantile Normaliztion. filterOutWithPreMask: false, // Can be used to multiply final output with premodel output mask to crean noisy areas @@ -327,15 +338,15 @@ const inferenceModelsList = [ modelName: '\u{1F52A} Brain Mask (High Acc, Low Mem)', labelsPath: null, colorsPath: null, - preModelId: 1, // Model run first e.g. crop the brain { null, 1, 2, .. } + preModelId: null, // Model run first e.g. crop the brain { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference numOverlapBatches: 0, // Number of extra overlap batches for inference enableTranspose: true, // Keras and tfjs input orientation may need a tranposing step to be matched enableCrop: true, // For speed-up inference, crop brain from background before feeding to inference model to lower memory use. - cropPadding: 2, // Padding size add to cropped brain + cropPadding: 0, // Padding size add to cropped brain autoThreshold: 0, // Threshold between 0 and 1, given no preModel and tensor is normalized either min-max or by quantiles. Will remove noisy voxels around brain - enableQuantileNorm: false, // Some models needs Quantile Normaliztion. + enableQuantileNorm: true, // Some models needs Quantile Normaliztion. filterOutWithPreMask: false, // Can be used to multiply final output with premodel output mask to crean noisy areas enableSeqConv: true, // For low memory system and low configuration, enable sequential convolution instead of last layer textureSize: 0, // Requested Texture size for the model, if unknown can be 0. @@ -352,6 +363,7 @@ const inferenceModelsList = [ modelName: '\u{1F52A} Aparc+Aseg 104 (High Mem, Fast)', labelsPath: './models/model21_104class/labels.json', colorsPath: './models/model21_104class/colorLUT.json', + colormapPath: './models/model21_104class/colormap.json', preModelId: 1, // model run first e.g. Brain_Extraction { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -377,6 +389,7 @@ const inferenceModelsList = [ modelName: '\u{1F52A} Aparc+Aseg 104 (Low Mem, Slow)', labelsPath: './models/model21_104class/labels.json', colorsPath: './models/model21_104class/colorLUT.json', + colormapPath: './models/model21_104class/colormap.json', preModelId: 1, // model run first e.g. Brain_Extraction { null, 1, 2, .. } preModelPostProcess: false, // If true, perform postprocessing to remove noisy regions after preModel inference generate output. isBatchOverlapEnable: false, // create extra overlap batches for inference @@ -395,7 +408,7 @@ const inferenceModelsList = [ description: 'FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time. ' } -] // inferenceModelsListX +] // inferenceModelsList async function checkZero(timeValue) { return timeValue < 10 ? timeValue : '0' + timeValue @@ -970,7 +983,8 @@ async function generateBrainMask( modelEntry, opts, callbackUI, - callbackImg + callbackImg, + isFinalImage = true ) { console.log('Generate Brain Masking ... ') // Convert all slices into 1 Dim array to download @@ -1030,9 +1044,10 @@ async function generateBrainMask( brainOut.push.apply(brainOut, allSlices[sliceIdx]) }*/ } - - callbackImg(brainOut, opts, modelEntry) - callbackUI('Segmentation finished', 0) + if (isFinalImage || opts.showPhase1Output) {//all done + callbackImg(brainOut, opts, modelEntry) + callbackUI('Segmentation finished', 0) + } return tf.tensor(brainOut, [num_of_slices, slice_height, slice_width]) } @@ -1815,9 +1830,6 @@ async function inferenceFullVolumeSeqCovLayerPhase2( } const Postprocess_t = ((performance.now() - startTime) / 1000).toFixed(4) - // document.getElementById("progressBar").style.width = 0; - tf.engine().disposeVariables() - console.log( 'Processing the whole brain volume in tfjs for multi-class output mask took : ', ((performance.now() - inferenceStartTime) / 1000).toFixed(4) + ' Seconds' @@ -1831,8 +1843,9 @@ async function inferenceFullVolumeSeqCovLayerPhase2( if (opts.telemetryFlag) { await submitTiming2GoogleSheet(statData, callbackUI) } - callbackImg(outimg, opts, modelEntry) callbackUI('Segmentation finished', 0) + callbackImg(outimg, opts, modelEntry) + return 0 } else { i++ } @@ -2316,8 +2329,9 @@ async function inferenceFullVolumePhase2( submitTiming2GoogleSheet(statData, callbackUI) } clearInterval(timer) - callbackImg(outimg, opts, modelEntry) callbackUI('Segmentation finished', 0) + callbackImg(outimg, opts, modelEntry) + return 0 } i++ }, delay) @@ -2351,7 +2365,6 @@ async function inferenceFullVolumePhase1( statData.No_SubVolumes = 1 // load pre-model for inference first, can be null if no pre-model such as GWM models if (modelEntry.preModelId) { - // let preModel = await load_model(inferenceModelsList[ modelEntry["preModelId"] - 1]['path'] ) const preModel = await load_model(inferenceModelsList[modelEntry.preModelId - 1].path) const transpose = inferenceModelsList[modelEntry.preModelId - 1].enableTranspose const quantileNorm = inferenceModelsList[modelEntry.preModelId - 1].enableQuantileNorm @@ -2374,7 +2387,7 @@ async function inferenceFullVolumePhase1( // -- Transpose MRI data to be match pytorch/keras input output // -- Check if pre-model needs transpose.. if (transpose) { - preModel_slices_3d = preModel_slices_3d.transpose() + preModel_slices_3d = await preModel_slices_3d.transpose() console.log('Input transposed for pre-model') } else { console.log('Transpose not enabled for pre-model') @@ -2619,7 +2632,8 @@ async function inferenceFullVolumePhase1( modelEntry, opts, callbackUI, - callbackImg + callbackImg, + false ) await tf.dispose(outLabelVolume) console.log(' Phase-1 num of tensors after generateBrainMask: ', tf.memory().numTensors) @@ -2688,13 +2702,14 @@ async function inferenceFullVolumePhase1( statData, niftiImage ) + return 0 // inferenceFullVolumeSeqCovLayerPhase2(model, slices_3d.transpose(), num_of_slices, slice_height, slice_width, slices_3d_mask) } else { // Mask cropping BUT no seq conv console.log('------ Mask Cropping - NO Seq Convoluton ------') // ? await // todo output not used outimg = await - inferenceFullVolumePhase2( + await inferenceFullVolumePhase2( model, slices_3d, num_of_slices, @@ -2712,7 +2727,7 @@ async function inferenceFullVolumePhase1( } } else { // -- In version 3.0.0 this function not used - inferenceSubVolumes(model, slices_3d, num_of_slices, slice_height, slice_width, slices_3d_mask) + await inferenceSubVolumes(model, slices_3d, num_of_slices, slice_height, slice_width, slices_3d_mask) // inferenceSubVolumes(model, slices_3d.transpose(), num_of_slices, slice_height, slice_width, slices_3d_mask) } } diff --git a/bwlabels.js b/bwlabels.js index a067fcd..55cf46a 100644 --- a/bwlabels.js +++ b/bwlabels.js @@ -6,9 +6,7 @@ export class BWLabeler { } // idx() // determine if voxels below candidate voxel have already been assigned a label - check_previous_slice(bw, il, r, c, sl, dim, conn, tt) { - // const nabo: number[] = []; - const nabo = new Uint32Array(27) + check_previous_slice(bw, il, r, c, sl, dim, conn, tt, nabo, tn) { let nr_set = 0 if (!sl) { return 0 @@ -73,7 +71,7 @@ export class BWLabeler { } } if (nr_set) { - this.fill_tratab(tt, nabo, nr_set) + this.fill_tratab(tt, nabo, nr_set, tn) return nabo[0] } else { return 0 @@ -82,6 +80,8 @@ export class BWLabeler { // provisionally label all voxels in volume do_initial_labelling(bw, dim, conn) { + const naboPS = new Uint32Array(27) + const tn = new Uint32Array(27 + 5) let label = 1 const kGrowArrayBy = 8192 let ttn = kGrowArrayBy @@ -96,7 +96,7 @@ export class BWLabeler { if (val === 0) { continue } - nabo[0] = this.check_previous_slice(bw, il, r, c, sl, dim, conn, tt) + nabo[0] = this.check_previous_slice(bw, il, r, c, sl, dim, conn, tt, naboPS, tn) if (nabo[0]) { nr_set += 1 } @@ -130,7 +130,7 @@ export class BWLabeler { } if (nr_set) { il[this.idx(r, c, sl, dim)] = nabo[0] - this.fill_tratab(tt, nabo, nr_set) + this.fill_tratab(tt, nabo, nr_set, tn) } else { il[this.idx(r, c, sl, dim)] = label if (label >= ttn) { @@ -156,9 +156,8 @@ export class BWLabeler { } // do_initial_labelling() // translation table unifies a region that has been assigned multiple classes - fill_tratab(tt, nabo, nr_set) { + fill_tratab(tt, nabo, nr_set, tn) { let cntr = 0 - const tn = new Uint32Array(nr_set + 5).fill(0) const INT_MAX = 2147483647 let ltn = INT_MAX for (let i = 0; i < nr_set; i++) { diff --git a/main.js b/main.js index e8b21f0..2028be0 100644 --- a/main.js +++ b/main.js @@ -43,29 +43,33 @@ async function main() { saveBtn.onclick = function () { nv1.volumes[1].saveToDisk("Custom.nii") } - + async function fetchJSON(fnm) { + const response = await fetch(fnm) + const js = await response.json() + return js + } async function callbackImg(img, opts, modelEntry) { - while (nv1.volumes.length > 1) { - nv1.removeVolume(nv1.volumes[1]) + await nv1.removeVolume(nv1.volumes[1]) } - let overlayVolume = await nv1.volumes[0].clone() overlayVolume.zeroImage() overlayVolume.hdr.scl_inter = 0 overlayVolume.hdr.scl_slope = 1 overlayVolume.img = new Uint8Array(img) - let colormap = opts.atlasSelectedColorTable.toLowerCase() - const cmaps = nv1.colormaps() - if (!cmaps.includes(colormap)) { - colormap = 'actc' - if (modelEntry.type === 'Atlas') { - colormap = 'random' - } + if (modelEntry.colormapPath) { + let cmap = await fetchJSON(modelEntry.colormapPath) + overlayVolume.setColormapLabel(cmap) + } else { + let colormap = opts.atlasSelectedColorTable.toLowerCase() + const cmaps = nv1.colormaps() + if (!cmaps.includes(colormap)) { + colormap = 'actc' + } + overlayVolume.colormap = colormap } - overlayVolume.colormap = colormap overlayVolume.opacity = opacitySlider.value / 255 - nv1.addVolume(overlayVolume) + await nv1.addVolume(overlayVolume) } function callbackUI(message = "", progressFrac = -1, modalMessage = "") { console.log(message) @@ -84,12 +88,12 @@ async function main() { document.getElementById("location").innerHTML = "  " + data.string } for (let i = 0; i < inferenceModelsList.length; i++) { - var option = document.createElement("option"); + var option = document.createElement("option") option.text = inferenceModelsList[i].modelName option.value = inferenceModelsList[i].id.toString() - modelSelect.appendChild(option); + modelSelect.appendChild(option) } - modelSelect.selectedIndex = -1; + modelSelect.selectedIndex = -1 } main() \ No newline at end of file diff --git a/public/models/model18cls/colormap.json b/public/models/model18cls/colormap.json new file mode 100644 index 0000000..ee61421 --- /dev/null +++ b/public/models/model18cls/colormap.json @@ -0,0 +1,6 @@ +{ + "R": [ 0, 245, 205, 120, 196, 220, 230, 0, 122, 236, 12, 204, 42, 119, 220, 103, 255, 165], + "G": [ 0, 245, 62, 18, 58, 248, 148, 118, 186, 13, 48, 182, 204, 159, 216, 255, 165, 42], + "B": [ 0, 245, 78, 134, 250, 164, 34, 14, 220, 176, 255, 142, 164, 176, 20, 255, 0, 42], + "labels": [ "Unknown", "Cerebral-White-Matter", "Cerebral-Cortex", "Lateral-Ventricle", "Inferior-Lateral-Ventricle", "Cerebellum-White-Matter", "Cerebellum-Cortex", "Thalamus", "Caudate", "Putamen", "Pallidum", "3rd-Ventricle", "4th-Ventricle", "Brain-Stem", "Hippocampus", "Amygdala", "Accumbens-area", "VentralDC"] +} \ No newline at end of file diff --git a/public/models/model20chan3cls/colormap.json b/public/models/model20chan3cls/colormap.json new file mode 100644 index 0000000..2343358 --- /dev/null +++ b/public/models/model20chan3cls/colormap.json @@ -0,0 +1,6 @@ +{ + "R": [ 0, 255, 205], + "G": [ 0, 255, 62], + "B": [ 0, 255, 78], + "labels": [ "background", "White Matter", "Grey Matter"] +} \ No newline at end of file diff --git a/public/models/model21_104class/colormap.json b/public/models/model21_104class/colormap.json new file mode 100644 index 0000000..f728661 --- /dev/null +++ b/public/models/model21_104class/colormap.json @@ -0,0 +1,6 @@ +{ + "R": [ 0, 25, 125, 100, 220, 220, 180, 220, 180, 140, 20, 35, 225, 200, 160, 20, 60, 220, 20, 220, 120, 220, 220, 60, 160, 80, 75, 20, 20, 140, 80, 100, 70, 150, 255, 25, 125, 100, 220, 220, 180, 220, 180, 140, 20, 35, 225, 200, 160, 20, 60, 220, 20, 220, 120, 220, 220, 60, 160, 80, 75, 20, 20, 140, 80, 100, 70, 150, 255, 0, 0, 122, 122, 236, 236, 12, 13, 220, 220, 103, 103, 255, 255, 165, 165, 245, 245, 120, 196, 120, 196, 204, 42, 60, 119, 220, 220, 230, 230, 0, 0, 0, 0, 0], + "G": [ 0, 100, 100, 25, 20, 20, 220, 60, 40, 20, 30, 75, 140, 35, 100, 220, 220, 180, 100, 60, 100, 20, 180, 20, 140, 20, 50, 220, 180, 220, 160, 0, 70, 150, 192, 100, 100, 25, 20, 20, 220, 60, 40, 20, 30, 75, 140, 35, 100, 220, 220, 180, 100, 60, 100, 20, 180, 20, 140, 20, 50, 220, 180, 220, 160, 0, 70, 150, 192, 118, 118, 186, 186, 13, 13, 48, 48, 216, 216, 255, 255, 165, 165, 42, 42, 245, 245, 18, 58, 18, 58, 182, 204, 60, 159, 248, 248, 148, 148, 0, 0, 0, 0, 0], + "B": [ 0, 40, 160, 0, 100, 10, 140, 220, 120, 140, 140, 50, 140, 75, 50, 60, 60, 140, 50, 20, 60, 20, 220, 220, 180, 140, 125, 160, 140, 220, 20, 100, 70, 200, 32, 40, 160, 0, 100, 10, 140, 220, 120, 140, 140, 50, 140, 75, 50, 60, 60, 140, 50, 20, 60, 20, 220, 220, 180, 140, 125, 160, 140, 220, 20, 100, 70, 200, 32, 14, 14, 220, 220, 176, 176, 255, 255, 20, 20, 255, 255, 0, 0, 42, 42, 245, 245, 134, 250, 134, 250, 142, 164, 60, 176, 164, 164, 34, 34, 64, 112, 160, 208, 255], + "labels": [ "BG", "ctx-lh-bankssts", "ctx-lh-caudalanteriorcingulate", "ctx-lh-caudalmiddlefrontal", "ctx-lh-cuneus", "ctx-lh-entorhinal", "ctx-lh-fusiform", "ctx-lh-inferiorparietal", "ctx-lh-inferiortemporal", "ctx-lh-isthmuscingulate", "ctx-lh-lateraloccipital", "ctx-lh-lateralorbitofrontal", "ctx-lh-lingual", "ctx-lh-medialorbitofrontal", "ctx-lh-middletemporal", "ctx-lh-parahippocampal", "ctx-lh-paracentral", "ctx-lh-parsopercularis", "ctx-lh-parsorbitalis", "ctx-lh-parstriangularis", "ctx-lh-pericalcarine", "ctx-lh-postcentral", "ctx-lh-posteriorcingulate", "ctx-lh-precentral", "ctx-lh-precuneus", "ctx-lh-rostralanteriorcingulate", "ctx-lh-rostralmiddlefrontal", "ctx-lh-superiorfrontal", "ctx-lh-superiorparietal", "ctx-lh-superiortemporal", "ctx-lh-supramarginal", "ctx-lh-frontalpole", "ctx-lh-temporalpole", "ctx-lh-transversetemporal", "ctx-lh-insula", "ctx-rh-bankssts", "ctx-rh-caudalanteriorcingulate", "ctx-rh-caudalmiddlefrontal", "ctx-rh-cuneus", "ctx-rh-entorhinal", "ctx-rh-fusiform", "ctx-rh-inferiorparietal", "ctx-rh-inferiortemporal", "ctx-rh-isthmuscingulate", "ctx-rh-lateraloccipital", "ctx-rh-lateralorbitofrontal", "ctx-rh-lingual", "ctx-rh-medialorbitofrontal", "ctx-rh-middletemporal", "ctx-rh-parahippocampal", "ctx-rh-paracentral", "ctx-rh-parsopercularis", "ctx-rh-parsorbitalis", "ctx-rh-parstriangularis", "ctx-rh-pericalcarine", "ctx-rh-postcentral", "ctx-rh-posteriorcingulate", "ctx-rh-precentral", "ctx-rh-precuneus", "ctx-rh-rostralanteriorcingulate", "ctx-rh-rostralmiddlefrontal", "ctx-rh-superiorfrontal", "ctx-rh-superiorparietal", "ctx-rh-superiortemporal", "ctx-rh-supramarginal", "ctx-rh-frontalpole", "ctx-rh-temporalpole", "ctx-rh-transversetemporal", "ctx-rh-insula", "Left-Thalamus-Proper*", "Right-Thalamus-Proper*", "Left-Caudate", "Right-Caudate", "Left-Putamen", "Right-Putamen", "Left-Pallidum", "Right-Pallidum", "Left-Hippocampus", "Right-Hippocampus", "Left-Amygdala", "Right-Amygdala", "Left-Accumbens-area", "Right-Accumbens-area", "Left-VentralDC", "Right-VentralDC", "Left-Cerebral-White-Matter", "Right-Cerebral-White-Matter", "Left-Lateral-Ventricle", "Left-Inf-Lat-Vent", "Right-Lateral-Ventricle", "Right-Inf-Lat-Vent", "3rd-Ventricle", "4th-Ventricle", "CSF", "Brain-Stem", "Left-Cerebellum-White-Matter", "Right-Cerebellum-White-Matter", "Left-Cerebellum-Cortex", "Right-Cerebellum-Cortex", "CC_Posterior", "CC_Mid_Posterior", "CC_Central", "CC_Mid_Anterior", "CC_Anterior"] +} \ No newline at end of file diff --git a/public/models/model30chan18cls/colormap.json b/public/models/model30chan18cls/colormap.json new file mode 100644 index 0000000..ee61421 --- /dev/null +++ b/public/models/model30chan18cls/colormap.json @@ -0,0 +1,6 @@ +{ + "R": [ 0, 245, 205, 120, 196, 220, 230, 0, 122, 236, 12, 204, 42, 119, 220, 103, 255, 165], + "G": [ 0, 245, 62, 18, 58, 248, 148, 118, 186, 13, 48, 182, 204, 159, 216, 255, 165, 42], + "B": [ 0, 245, 78, 134, 250, 164, 34, 14, 220, 176, 255, 142, 164, 176, 20, 255, 0, 42], + "labels": [ "Unknown", "Cerebral-White-Matter", "Cerebral-Cortex", "Lateral-Ventricle", "Inferior-Lateral-Ventricle", "Cerebellum-White-Matter", "Cerebellum-Cortex", "Thalamus", "Caudate", "Putamen", "Pallidum", "3rd-Ventricle", "4th-Ventricle", "Brain-Stem", "Hippocampus", "Amygdala", "Accumbens-area", "VentralDC"] +} \ No newline at end of file diff --git a/public/models/model30chan50cls/colormap.json b/public/models/model30chan50cls/colormap.json new file mode 100644 index 0000000..102ee20 --- /dev/null +++ b/public/models/model30chan50cls/colormap.json @@ -0,0 +1,6 @@ +{ + "R": [ 0, 245, 196, 220, 230, 0, 122, 236, 12, 119, 220, 103, 60, 255, 165, 0, 25, 125, 100, 220, 220, 180, 220, 180, 140, 20, 35, 225, 200, 160, 20, 60, 220, 20, 220, 120, 220, 220, 60, 160, 80, 75, 20, 20, 140, 80, 100, 70, 150, 255], + "G": [ 0, 245, 58, 248, 148, 118, 186, 13, 48, 159, 216, 255, 60, 165, 42, 0, 100, 100, 25, 20, 20, 220, 60, 40, 20, 30, 75, 140, 35, 100, 220, 220, 180, 100, 60, 100, 20, 180, 20, 140, 20, 50, 220, 180, 220, 160, 0, 70, 150, 192], + "B": [ 0, 245, 250, 164, 34, 14, 220, 176, 255, 176, 20, 255, 60, 0, 42, 208, 40, 160, 0, 100, 10, 140, 220, 120, 140, 140, 50, 140, 75, 50, 60, 60, 140, 50, 20, 60, 20, 220, 220, 180, 140, 125, 160, 140, 220, 20, 100, 70, 200, 32], + "labels": [ "BG", "Cerebral-White-Matter", "Ventricle", "Cerebellum-White-Matter", "Cerebellum", "Thalamus-Proper*", "Caudate", "Putamen", "Pallidum", "Brain-Stem", "Hippocampus", "Amygdala", "CSF", "Accumbens-area", "VentralDC", "CC_Posterior / CC_Mid_Posterior / CC_Central / CC_Mid_Anterior / CC_Anterior", "ctx-bankssts", "ctx-caudalanteriorcingulate", "ctx-caudalmiddlefrontal", "ctx-cuneus", "ctx-entorhinal", "ctx-fusiform", "ctx-inferiorparietal", "ctx-inferiortemporal", "ctx-isthmuscingulate", "ctx-lateraloccipital", "ctx-lateralorbitofrontal", "ctx-lingual", "ctx-medialorbitofrontal", "ctx-middletemporal", "ctx-parahippocampal", "ctx-paracentral", "ctx-parsopercularis", "ctx-parsorbitalis", "ctx-parstriangularis", "ctx-pericalcarine", "ctx-postcentral", "ctx-posteriorcingulate", "ctx-precentral", "ctx-precuneus", "ctx-rostralanteriorcingulate", "ctx-rostralmiddlefrontal", "ctx-superiorfrontal", "ctx-superiorparietal", "ctx-superiortemporal", "ctx-supramarginal", "ctx-frontalpole", "ctx-temporalpole", "ctx-transversetemporal", "ctx-insula"] +} \ No newline at end of file diff --git a/public/models/model5_gw_ae/colormap.json b/public/models/model5_gw_ae/colormap.json new file mode 100644 index 0000000..9838f5d --- /dev/null +++ b/public/models/model5_gw_ae/colormap.json @@ -0,0 +1,6 @@ +{ + "R": [0, 255], + "G": [0, 0], + "B": [0, 0], + "labels": ["background", "brain"] +} \ No newline at end of file diff --git a/public/models/model5_gw_ae/colormap3.json b/public/models/model5_gw_ae/colormap3.json new file mode 100644 index 0000000..2343358 --- /dev/null +++ b/public/models/model5_gw_ae/colormap3.json @@ -0,0 +1,6 @@ +{ + "R": [ 0, 255, 205], + "G": [ 0, 255, 62], + "B": [ 0, 255, 78], + "labels": [ "background", "White Matter", "Grey Matter"] +} \ No newline at end of file