diff --git a/biswebpython/core/bis_objects.py b/biswebpython/core/bis_objects.py index 5ad62f274..3f0e5b4cd 100644 --- a/biswebpython/core/bis_objects.py +++ b/biswebpython/core/bis_objects.py @@ -374,9 +374,11 @@ def save(self,fname): try: out_image = nib.Nifti1Image(self.data_array, self.affine); # Preserve temporal spacing - out_image.header['pixdim'][4]=self.spacing[3] - out_image.header['pixdim'][5]=self.spacing[4] - + try: + out_image.header['pixdim'][4]=self.spacing[3] + out_image.header['pixdim'][5]=self.spacing[4] + except: + print('') nib.save(out_image, fname) self.filename=fname; diff --git a/biswebpython/core/bis_wasmutils.py b/biswebpython/core/bis_wasmutils.py index afa8579eb..a1e8e11d2 100644 --- a/biswebpython/core/bis_wasmutils.py +++ b/biswebpython/core/bis_wasmutils.py @@ -55,7 +55,7 @@ def load_library(name=''): print('____ Recomputing name:',name); - print('___ Loading library from',name); +# print('___ Loading library from',name); m=ctypes.CDLL(name); if (m.uses_gpl()): print("____ Library Loaded from",name,"result=",m.test_wasm(),' (should be 1700)'); diff --git a/biswebpython/modules/dualImageRegression.py b/biswebpython/modules/dualImageRegression.py index 6f75adfd0..e4a9b5b44 100644 --- a/biswebpython/modules/dualImageRegression.py +++ b/biswebpython/modules/dualImageRegression.py @@ -44,11 +44,11 @@ def createDescription(self): }, { "type": "image", - "name": "Input Image", + "name": "Regressor Image", "description": "The input image (uv) to preprocess", "varname": "regressor", "shortname" : "r", - "required": False + "required": True } ], "outputs": [ @@ -130,10 +130,15 @@ def directInvokeAlgorithm(self,vals): if (doregress): print('.... computing dual image regression') outdata=self.dualRegress(idata,rdata,debug); + else: + print('.... not computing dual image regression') + outdata=idata; if (df): print('.... computing df/f') outdata=np.transpose((np.transpose(outdata)+mean)/mean) + else: + print('.... not computing df/f') outdata=np.reshape(outdata,sz); self.outputs['output'] = bis_objects.bisImage().create(outdata,input.spacing,input.affine); diff --git a/biswebpython/modules/initializeCalciumStudy.py b/biswebpython/modules/initializeCalciumStudy.py index 235df45cf..4b50132c2 100644 --- a/biswebpython/modules/initializeCalciumStudy.py +++ b/biswebpython/modules/initializeCalciumStudy.py @@ -120,13 +120,26 @@ def loadChannels(self,infilename,movies,usedframes,mat,spacing,triggers): imgl=page.convert(mode='F') v=np.array(imgl) channel=triggers[c][1]-1 - if (channel>0): + flag=0 +# if (usedframes[0]>5900 or ( usedframes[0]>15 and usedframes[0]<20)): +# print('Channel=',triggers[c][1],'c=',c,' channel=',channel,' usedrames=',usedframes); +# flag=1 + + if (channel>=0): movies[channel][:,:,0,usedframes[channel]] = np.array(imgl,dtype=np.uint16) - if (c%125==0 or c<4 or c>(expected_num_frames-4)): - s='...\t added frame {:5d}/{:5d} to channel {:d} as new frame {:5d} based on trigger {:s}'.format(c+1,expected_num_frames,channel+1,usedframes[channel]+1,str(triggers[c])) + else: + print('....\t\t Skipping ',triggers[c][1] ,' < 0 c=',c) + + if (c%125==0 or c<4 or c>(expected_num_frames-4) or flag>0): + q='added'; + if (channel<0): + q='not '+q; + + s='...\t '+q+' frame {:5d}/{:5d} to channel {:d} as new frame {:5d} based on trigger {:s}'.format(c+1,expected_num_frames,channel+1,usedframes[channel]+1,str(triggers[c])) print(s) c=c+1; - usedframes[channel]=usedframes[channel]+1 + if (channel>=0): + usedframes[channel]=usedframes[channel]+1 if (c>100 and DUMMY_MODE): break @@ -216,7 +229,10 @@ def convertRuns(self,data,indir,outdir): lt=len(triggers) for k in range(0,lt): v=triggers[k][1]-1; - numframes[v]=numframes[v]+1; + if (v>=0 and v0) { + pythoncommand=vals['python']+' '+path.join(s.substring(0,index-1), + path.join('biswebpython','biswebpy.py')); + } + } + console.log('Python=',pythoncommand); + + + this.outputs['output']=new BisWebTextObject(); + this.outputs['output'].setText('hello'); + + let outtext='#\n'; + + let numchannels=data.numchannels; + let numruns=data.runs.length; + let channelnames=data.channelnames; + + let outnames=[]; + let debug=this.parseBoolean(vals['debug']); + let step1names={}; + + let step1=[]; + let step2=[]; + let step3=[]; + + this.resampledmaskname=''; + + for (let run=0;run',outname); + outnames.push(outname); + step1.push(outname); + + outtext=outtext+outname+' : '+fname+'\n\t'+nodejscommand+` largeextractframes -i ${fname} -o ${outname}`; + outtext+=` --beginframe ${vals['trimstart']} --endframe ${vals['trimend']}`; + if (!debug) outtext+=` > ${outname}.log 2>&1`; + outtext+=`\n\n`; + + // Smoothing + let ind2=outname.lastIndexOf('.nii.gz'); + let outname2=outname.substr(0,ind2)+'_smoothed.nii.gz'; + outnames.push(outname2); + outtext=outtext+outname2+' : '+outname+'\n\t'+nodejscommand+` largesmoothfilter -i ${outname}`; + outtext+=` -o ${outname2}`; + outtext+=` --sigma ${vals['sigma']} --inmm ${vals['inmm']} --fwhmax ${vals['fwhmax']}` + if (!debug) outtext+=` > ${outname2}.log 2>&1`; + outtext+=`\n\n`; + step1.push(outname2); + + let tmp='1 0 0 0\n0 1 0 0\n0 0 1 0\n0 0 0 1'; + let identity=path.join(tmpdir,'identity.matr'); + if (run===0 && channel===0) { + await bis_genericio.write(identity,tmp); + } + + let ind3=outname2.lastIndexOf('.nii.gz'); + let outname3=outname2.substr(0,ind3)+'_resampled.nii.gz'; + outnames.push(outname3); + let refname=this.inputs['refimage'].getFilename(); + + outtext=outtext+outname3+' : '+outname2+'\n\t'+nodejscommand+` largereslice -i ${outname2} -o ${outname3}`; + outtext+=` -r ${refname} -x ${identity} --interpolation ${vals['interpolation']}`; + outtext+=` --res ${vals['res']}`; + if (!debug) outtext+=` > ${outname3}.log 2>&1`; + outtext+=`\n\n`; + step2.push(outname3); + + if (run===0 && channel===0) { + let maskname=this.inputs['mask'].getFilename(); + let ind3=maskname.lastIndexOf('.nii.gz'); + let m2=path.basename(maskname.substr(0,ind3)); + console.log('Maskname=',maskname,vals.odir); + this.resampledmaskname=path.join(vals.odir,m2+'_resampled.nii.gz'); + console.log(' N=',this.resampledmaskname); + outnames.push(this.resampledmaskname); + let outname3=this.resampledmaskname; + let refname=this.inputs['refimage'].getFilename(); + + outtext=outtext+outname3+' : '+maskname+'\n\t'+nodejscommand+` largereslice -i ${maskname} -o ${outname3}`; + outtext+=` -r ${refname} -x ${identity} --interpolation 0`; + outtext+=` --res ${vals['res']}`; + if (!debug) outtext+=` > ${outname3}.log 2>&1`; + outtext+=`\n\n`; + step2.push(outname3); + + } + + step1names[run][channel]=outname3; + } + } + + for (let run=0;run ${outname4}.log 2>&1`; + outtext+=`\n\n`; + + let ind5=outname4.lastIndexOf('.nii.gz'); + + let outname5=outname4.substr(0,ind5)+'_masked.nii.gz'; + outname5=path.join(vals.odir,path.basename(outname5)); + outnames.push(outname5); + step3.push(outname5); + let maskname=this.inputs['mask'].getFilename(); + + outtext+=outname5+' : '+outname4+'\n\t'+nodejscommand+` largemaskimage -i ${outname4} -m ${this.resampledmaskname} -o ${outname5}`; + outtext+=` --dilation ${vals['dilation']}`; + if (!debug) outtext+=` > ${outname5}.log 2>&1`; + outtext+=`\n\n`; + + } + + console.log('outtext=',outtext) + + let makefile=path.join(vals.odir,'makefile'); + + let top='all : '+outnames.join(' ')+'\n\t echo "Computing all"\n\n'; + + top+='step1 : '+step1.join(' ')+'\n\n'; + top+='step2 : '+step2.join(' ')+'\n\n'; + top+='step3 : '+step3.join(' ')+'\n\n'; + + + outtext=top+outtext; + + await bis_genericio.write(makefile,outtext); + console.log('Makefile saved in ',makefile) + + + + return Promise.resolve('Done'); + + } +}; + +module.exports = CalciumPreprocessModule; diff --git a/js/node/largeExtractFrames.js b/js/node/largeExtractFrames.js index e528431ed..5c6271f37 100644 --- a/js/node/largeExtractFrames.js +++ b/js/node/largeExtractFrames.js @@ -124,8 +124,6 @@ class LargeExtractFramesModule extends BaseModule { let dims=input.getDimensions(); - if (endframe<0) - endframe=dims[3]-1; if (dims[4]<1) dims[4]=1; @@ -137,6 +135,10 @@ class LargeExtractFramesModule extends BaseModule { this.beginframe=dims[3]-1; this.endframe=endframe; + if (this.endframe<-1) { + this.endframe=dims[3]+this.endframe; + } + if (this.endframe=dims[3]) @@ -206,7 +208,7 @@ class LargeExtractFramesModule extends BaseModule { }; } - if (this.writeframe%5===0 || this.writeframe===this.numframes-1) + if (this.writeframe%50===0 || this.writeframe===this.numframes-1) debug=true; if (debug) diff --git a/js/node/largeMaskImage.js b/js/node/largeMaskImage.js new file mode 100644 index 000000000..35c43f107 --- /dev/null +++ b/js/node/largeMaskImage.js @@ -0,0 +1,212 @@ +2/* LICENSE + + _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ + + BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); + + - you may not use this software except in compliance with the License. + - You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) + + __Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.__ + + ENDLICENSE */ + +'use strict'; + +const biswrap = require('libbiswasm_wrapper'); +const BaseModule = require('basemodule.js'); +const baseutils = require('baseutils.js'); +const BisWebImage = require("bisweb_image.js"); +const largeImageUtil=require('largeImageUtil'); + + + +/** + * Runs linear registration on an image set given a reference image and returns the set of transformations required + * to align the image set to the reference image. Applies only affine (linear) transformations (no stretch/shear). + */ +class LargeMaskImageModule extends BaseModule { + constructor() { + super(); + this.name = 'largeMaskImage'; + this.JSOnly=true; + this.useworker=false; + } + + getDescription() { + let des={ + "name": "Mask Image", + "description": "Mask Large Image Time Series", + "author": "Xenios Papademetris", + "version": "1.0", + "buttonName": "Execute", + "shortname" : "msked", + "slicer" : true, + "inputs": [ + { + 'type': 'image', + 'name': 'Mask', + 'description': 'The image frame to mask with', + 'varname': 'mask', + 'shortname': 'm', + 'required': true, + } + ], + "outputs" : [], + "params": [ + { + "name": "Dilation", + "description": "The amount (in voxels) to dilate the mask by", + "priority": 2, + "advanced": false, + "gui": "slider", + "type": "int", + "varname": "dilation", + "default" : 0, + "low" : 0, + "high" : 5 + }, + baseutils.getDebugParam(), + { + "name": "input", + "description": "This is the input time series filename to be masked", + "priority": 0, + "advanced": false, + "varname": "input", + "shortname" : "i", + "type": 'string', + "default": '', + }, + { + "name": "output", + "description": "This is the output masked time series filename", + "priority": 0, + "advanced": false, + "varname": "output", + "shortname" : "o", + "type": 'string', + "default": '', + } + ] + }; + + + return des; + } + + async directInvokeAlgorithm(vals) { + console.log('Large Mask Image invoking with vals', JSON.stringify(vals)); + + this.vals=vals; + + this.mask = this.inputs['mask']; + let debug=super.parseBoolean(vals.debug); + + this.outputname=largeImageUtil.createOutputFilename(vals['output'],vals['input'],'msked','.nii.gz'); + this.vals['output']=this.outputname; + + let inputname=vals['input']; + let input=new BisWebImage(); + + let headerinfo=null; + try { + headerinfo=await input.loadHeaderOnly(inputname,debug); + } catch(e) { + return Promise.reject('Failed to read the header in largemotionReslice '+inputname); + } + + if (!input.hasSameSizeAndOrientation(this.mask,'input image','reference image',true)) { + console.log('Mask does not have the same size or orientation as the input'); + console.log('Mask=',this.mask.getDescription()); + console.log('Input=',input.getDescription()); + return Promise.reject('Failed'); + } + + let dims=input.getDimensions(); + this.numframes=dims[3]*dims[4]; + + await biswrap.initialize(); + + this.dilated=this.mask; + let dilation=parseInt(vals.dilation) + + if (dilation>0) { + let do3d=true; + if (dims[2]<2) { + do3d=false; + } + + console.log('+++++ Dilating mask by',dilation) + this.dilated=biswrap.morphologyOperationWASM(this.mask, { + "operation" : 'dilate', + "radius" : dilation, + "do3d" : do3d, + },this.parseBoolean(vals.debug)); + } + + this.resldimensions=this.mask.getDimensions(); + this.reslspacing = this.mask.getSpacing(); + + await largeImageUtil.readAndProcessLargeImage(inputname,this); + console.log('---------'); + console.log('Storing output'); + + } + + async processFrame(frame,frameImage) { + + let debug=false; + if (frame %100===0) + debug=true; + + + if (debug) + console.log(' In Frame',frame); + + if (frame===0) { + this.fileHandleObject={ + 'fd' : null, + 'filename' : '' + }; + } + + + if (frame===0) { + console.log('.... Output dimensions=',this.resldimensions, ' spa=', this.reslspacing, ' input=', frameImage.getDescription()); + } + + try { + let fdata=frameImage.getImageData(); + let mdata=this.dilated.getImageData(); + let np=fdata.length; + for (let i=0;iRef)', + 'description': 'Load the transformation used to reslice the image', + 'varname': 'xform', + 'shortname' : 'x', + 'required' : false, + 'guiviewer' : 'current', + }, + { + 'type': 'transform', + 'name': 'Transformation 2 (Ref->Conv)', + 'description': 'The second transformation to combine with first', + 'varname': 'xform2', + 'required' : false, + 'shortname' : 'y' + }, + { + 'type': 'transform', + 'name': 'Transformation 3 (Conv->EPI)', + 'description': 'The third transformation to combine with first and second', + 'varname': 'xform3', + 'required' : false, + 'shortname' : 'z' + } + ], + "outputs" : [], + "params": [ + { + "name": "Interpolation", + "description": "Which type of interpolation to use (3 = cubic, 1 = linear, 0 = nearest-neighbor)", + "priority": 1, + "advanced": false, + "gui": "dropdown", + "type": "int", + "default" : "3", + "varname": "interpolation", + "fields" : [ 0,1,3 ], + "restrictAnswer" : [ 0,1,3], + }, + { + "name": "Force Float", + "description": "If true force output to float", + "priority": 100, + "advanced": true, + "type": "boolean", + "default" : false, + "varname": "forcefloat", + }, + { + "name": "Fill Value", + "description": "Value to use for outside the image", + "priority": 2, + "advanced": true, + "gui": "slider", + "type": "float", + "varname": "backgroundvalue", + "default" : 0.0, + }, + { + "name": "Res factor", + "description": "The amount to downsample the reference by", + "priority": 2, + "advanced": false, + "gui": "slider", + "type": "float", + "varname": "res", + "default" : 2.0, + "low" : 1.0, + "high" : 4.0 + }, + baseutils.getDebugParam(), + ] + }; + + des.params.push({ + "name": "input", + "description": "This is the input (target) time series filename", + "priority": 0, + "advanced": false, + "varname": "input", + "shortname" : "i", + "type": 'string', + "default": '', + }); + + des.params.push({ + "name": "output", + "description": "This is the output motion corrected time series filename", + "priority": 0, + "advanced": false, + "varname": "output", + "shortname" : "o", + "type": 'string', + "default": '', + }); + + + + return des; + } + + async directInvokeAlgorithm(vals) { + console.log('LargeReslicing invoking with vals', JSON.stringify(vals)); + + this.vals=vals; + let reference = this.inputs['reference']; + let debug=super.parseBoolean(vals.debug); + + this.outputname=largeImageUtil.createOutputFilename(vals['output'],vals['input'],'motresl','.nii.gz'); + this.vals['output']=this.outputname; + + let inputname=vals['input']; + let input=new BisWebImage(); + + let headerinfo=null; + try { + headerinfo=await input.loadHeaderOnly(inputname,debug); + } catch(e) { + return Promise.reject('Failed to read the header in largeReslice '+inputname); + } + + if (!input.hasSameOrientation(reference,'input image','reference image',true)) + return Promise.reject('Failed'); + + let dims=input.getDimensions(); + this.numframes=dims[3]*dims[4]; + + this.resldimensions=reference.getDimensions(); + this.reslspacing = reference.getSpacing(); + let res=parseFloat(vals.res); + if (res<0.5) + res=0.5; + + console.log('oooo Original dimensions:',this.resldimensions,' spacing:', this.reslspacing); + for (let i=0;i<=2;i++) { + this.resldimensions[i]=Math.round(this.resldimensions[i]/res); + if (this.resldimensions[i]<1) + this.resldimensions[i]=1; + + if (this.resldimensions[i]>1) + this.reslspacing[i]=this.reslspacing[i]*res; + } + + let xform=this.inputs['xform'] || null; + let xform2=this.inputs['xform2'] || null; + let xform3=this.inputs['xform3'] || null; + + this.combinedXform=new BisWebTransformCollection(); + + if (xform) + this.combinedXform.addTransformation(xform); + if (xform2) + this.combinedXform.addTransformation(xform2); + if (xform3) + this.combinedXform.addTransformation(xform3); + + this.dt="same"; + if (vals.forcefloat) { + this.dt="float"; + } + + await biswrap.initialize(); + console.log('---------------------------',inputname,this.outputname); + await largeImageUtil.readAndProcessLargeImage(inputname,this); + console.log('---------'); + console.log('Storing output'); + + } + + async processFrame(frame,frameImage) { + + let debug=false; + if (frame %50===0) + debug=true; + + if (debug) + console.log(' In Frame',frame,this.combinedXform.getDescription()); + + if (frame===0) { + this.fileHandleObject={ + 'fd' : null, + 'filename' : '' + }; + } + + let resliceW =null; + + if (frame===0) { + console.log('Output dimensions=',this.resldimensions, ' spa=', this.reslspacing, ' input=', frameImage.getDescription()); + } + + try { + resliceW=biswrap.resliceImageWASM(frameImage, this.combinedXform, { + "interpolation": parseInt(this.vals.interpolation), + "datatype" : this.dt, + "backgroundValue" : parseFloat(this.vals.backgroundvalue), + "dimensions": this.resldimensions, + "spacing": this.reslspacing + }, debug); + + if (frame===0) { + this.storeCommentsInObject(resliceW, + process.argv.join(" "), + this.vals, baseutils.getSystemInfo(biswrap)); + } + } catch(e) { + console.log(e.stack); + return false; + } + + + let done=await largeImageUtil.writeOutput(frame,this.numframes,this.outputname,resliceW,this.fileHandleObject,debug); + if (debug) + console.log('ooooo resliced frame=',frame,' done=',done); + return done; + } +} + +module.exports = LargeReslicingModule; diff --git a/js/node/nodemoduleindex_base.js b/js/node/nodemoduleindex_base.js index cf848174b..a5d893fbd 100755 --- a/js/node/nodemoduleindex_base.js +++ b/js/node/nodemoduleindex_base.js @@ -26,12 +26,15 @@ const moduleImports = { 'regressiontests': require('./regressiontestmodule.js'), 'pipeline' : require('./pipelinemodule.js'), 'concatenateimages' : require('./concatenateImages.js'), + 'calciumpreprocess' : require('./calciumPreprocessModule.js'), 'stackimages' : require('./stackImages.js'), 'headerinfo' : require('./bis_headerinfo.js'), 'computeroilarge' : require('./computeROILarge.js'), 'largemotioncorrection' : require('./largeMotionCorrection.js'), 'largemotionreslice' : require('./largeMotionReslice.js'), + 'largereslice' : require('./largeReslice.js'), 'largeextractframes' : require('./largeExtractFrames.js'), + 'largemaskimage' : require('./largeMaskImage.js'), 'largemedianfilter' : require('./largeMedianFilter.js'), 'largesmoothfilter' : require('./largeSmoothFilter.js'), 'largeresampleimage' : require('./largeResampleImage.js'), diff --git a/js/utilities/bis_bidsutils.js b/js/utilities/bis_bidsutils.js index 72ba5a954..59f7b1194 100644 --- a/js/utilities/bis_bidsutils.js +++ b/js/utilities/bis_bidsutils.js @@ -262,7 +262,7 @@ let parseBIDSLabel = (name, directory) => { } if (directory === 'anatomical' || directory === 'anat') { - if ( (name.includes('t1') && name.includes('weight') ) || name.includes('mprage') || name.includes('t1w')) { bidsLabel = 'T1w'; } + if ( (name.includes('t1') && name.includes('weight') ) || name.includes('mpr') || name.includes('t1w')) { bidsLabel = 'T1w'; } else if (name.includes('t2') && name.includes('weight')) { bidsLabel = 'T2w'; } else if (name.includes('t1') && name.includes('rho')) { bidsLabel = 'T1rho'; } else if (name.includes('t1') && name.includes('map')) { bidsLabel = 'T1map'; } diff --git a/js/utilities/bis_connmatrix.js b/js/utilities/bis_connmatrix.js index 2d1d6b9b6..1d266f557 100644 --- a/js/utilities/bis_connmatrix.js +++ b/js/utilities/bis_connmatrix.js @@ -493,10 +493,11 @@ class ConnMatrix { * @param {array} neglines -- array of line pairs created by {@link ConnMatrix.createLinePairs} * @param {number} radius -- the sphere size for each node * @param {number} power -- the scale for each node + * @param {number} in_max_value -- if > 0 use this to normalize radius size, else compute it * @returns {Bis_3dCrosshairGeometry.preGeometry} out */ - draw3DLines(parc,poslines,neglines,radius,power,atlasinfo={}) { - + draw3DLines(parc,poslines,neglines,radius,power,in_max_value=0.0,atlasinfo={}) { + radius=radius || 2.0; power =power || 1.0; @@ -578,6 +579,11 @@ class ConnMatrix { var poslst0 = [],neglst0= [],poslst1=[],neglst1=[]; var maxp=0.25*this.maxsum; + console.log('Maxp=',maxp); + if (in_max_value>0.5) + maxp=0.25*in_max_value; + + console.log('Maxp (2)=',maxp,in_max_value); for (i=0;i { autoDrawLines();}); + + userPreferences.safeGetItem("internal").then( (f) => { if (f) { clist.push(adv.add(data,'matrixscaling').name('Matrix Scaling').onChange( () => { @@ -1611,7 +1620,6 @@ const bisGUIConnectivityControl = function(parent,orthoviewer,layoutmanager) { da3.onChange( () => { updateMeshesDisplay(); }); - let da4=disp2.add(data,'radius',0.2,4.0).name("Radius (3D)"); da4.onFinishChange( () => { autoDrawLines(); }); @@ -2036,6 +2044,7 @@ const bisGUIConnectivityControl = function(parent,orthoviewer,layoutmanager) { internal.parameters.length = 50; internal.parameters.thickness=2; internal.parameters.radius=1.0; + internal.parameters.maxdegree=0.0; internal.parameters.poscolor= "#ff0000"; internal.parameters.negcolor= "#00dddd"; for (let ia=0;ia { let prom=null; diff --git a/various/connatlas/allen2023/2023_left.vtk b/various/connatlas/allen2023/2023_left.vtk new file mode 100644 index 000000000..490212eb5 Binary files /dev/null and b/various/connatlas/allen2023/2023_left.vtk differ diff --git a/various/connatlas/allen2023/2023_right.vtk b/various/connatlas/allen2023/2023_right.vtk new file mode 100644 index 000000000..bcdbfa39e Binary files /dev/null and b/various/connatlas/allen2023/2023_right.vtk differ diff --git a/various/connatlas/allen2023/createsamplematrices.js b/various/connatlas/allen2023/createsamplematrices.js new file mode 100644 index 000000000..5cc7bc3ee --- /dev/null +++ b/various/connatlas/allen2023/createsamplematrices.js @@ -0,0 +1,44 @@ +require('../../../config/bisweb_pathconfig.js'); + + +const bis_genericio=require("bis_genericio"); +const BisWebMatrix=require("bisweb_matrix"); + +const matr=new BisWebMatrix(); +matr.allocate(172,172,0.0,'float'); + +const matr2=new BisWebMatrix(); +matr2.allocate(172,172,0.0,'float'); + + +matr.setElement(0,1,1); +matr.setElement(1,0,1); +matr.setElement(0,10,1); +matr.setElement(10,0,1); +matr.setElement(50,85,1); +matr.setElement(85,50,1); +matr.setElement(40,42,1); +matr.setElement(42,40,1); + +for (let row=0;row<172;row++) { + for (let col=0;col<172;col++) { + let v=matr.getElement(row,col); + if (v>0.0) { + console.log('Elem (',row,col,')=',v); + } + } +} + + +matr2.setElement(0,2,1); +matr2.setElement(2,0,1); +matr2.setElement(0,121,1); +matr2.setElement(121,0,1); +matr2.setElement(50,154,1); +matr2.setElement(154,50,1); +matr2.setElement(130,132,1); +matr2.setElement(132,130,1); + + +Promise.all([ matr.save('pos_allen.csv'), + matr2.save('neg_allen.csv') ]).then( () => { console.log('Done');}); diff --git a/various/connatlas/allen2023/setup.json b/various/connatlas/allen2023/setup.json new file mode 100644 index 000000000..08f4ac108 --- /dev/null +++ b/various/connatlas/allen2023/setup.json @@ -0,0 +1,15 @@ +{ + "multires" : [ + "output/right_allen_172.json" , + "output/left_allen_172.json" + ], + "atlas" : [ + "output/right_allen_172.json" , + "output/left_allen_172.json" + ], + "output" : [ + "output/lobes_allen_right_172.json" , + "output/lobes_allen_left_172.json" , + "output/allen_172_surface_atlas.bin.gz" + ] +} diff --git a/various/connatlas/allen2023/setup.tcl b/various/connatlas/allen2023/setup.tcl new file mode 100644 index 000000000..cea3c7c75 --- /dev/null +++ b/various/connatlas/allen2023/setup.tcl @@ -0,0 +1,9 @@ + +puts stdout "parsing setup for 368 atlas" + +set surface_names { "2023_right.vtk" "2023_left.vtk" } +set atlas_names { "2023_right.vtk" "2023_left.vtk" } +set output_names { "output/right_allen_172" "output/left_allen_172" } +set output_offsets { 1 1 } +set surface_points_ras 1 +set distance_threshold 36.0 diff --git a/web/images/allen_172.nii.gz b/web/images/allen_172.nii.gz new file mode 100644 index 000000000..e8d6fb052 Binary files /dev/null and b/web/images/allen_172.nii.gz differ diff --git a/web/images/allen_172_surface_atlas.bin.gz b/web/images/allen_172_surface_atlas.bin.gz new file mode 100644 index 000000000..4ee1145a9 Binary files /dev/null and b/web/images/allen_172_surface_atlas.bin.gz differ diff --git a/web/images/atlases/mouseallenmri.json b/web/images/atlases/mouseallenmri.json index 1c9c90a24..1a80d6dec 100644 --- a/web/images/atlases/mouseallenmri.json +++ b/web/images/atlases/mouseallenmri.json @@ -649,6 +649,12 @@ ] }, "parcellations": [ + { + "name": "Yale Allen 172", + "image": "allen_172.nii.gz", + "surface": "allen_172_surface_atlas.bin.gz", + "species": "mouse" + }, { "name": "Yale Allen Mouse Coarse", "image": "allen_coarse.nii.gz", @@ -667,4 +673,4 @@ "lobes": 0 } ] -} \ No newline at end of file +}