User Tools

Site Tools


documents:110822jsip_cooking:javascript_imagej_cookbook

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
documents:110822jsip_cooking:javascript_imagej_cookbook [2011/12/20 02:18] kotadocuments:110822jsip_cooking:javascript_imagej_cookbook [2020/11/26 08:24] (current) kota
Line 1: Line 1:
-\\ +
-\\ +
-\\ +
-\\ +
-\\ +
-\\ +
-\\ +
-\\ +
-\\ +
-\\ +
-\\+
 ====== Javascript (+ ImageJ) Cookbook ====== ====== Javascript (+ ImageJ) Cookbook ======
  
Line 23: Line 13:
 ==== Getting Directory Path Interactively ==== ==== Getting Directory Path Interactively ====
  
-<sxh javascript>+<code javascript>
 dc = DirectoryChooser("Select an output folder..."); dc = DirectoryChooser("Select an output folder...");
 dir = dc.getDirectory(); dir = dc.getDirectory();
 IJ.log(dir); IJ.log(dir);
-</sxh>+</code> 
 + 
 +==== Getting File Path Interactively ==== 
 + 
 +<code js> 
 +importClass(Packages.ij.io.OpenDialog); 
 + 
 +od = new OpenDialog("Open As String", ""); 
 +directory = od.getDirectory(); 
 +name = od.getFileName(); 
 +path = directory + name; 
 +IJ.log(path); 
 +</code>
  
 ==== Path String Management ==== ==== Path String Management ====
-<sxh javascript>+<code javascript>
 // Example code for managing path strings.  // Example code for managing path strings. 
 // Kota Miura (miura@embl.de) // Kota Miura (miura@embl.de)
Line 56: Line 58:
 IJ.log(traindata); IJ.log(traindata);
  
-</sxh>+</code>
  
-[[https://github.com/cmci/ijmacros/blob/master/PathStringManagement.js]]+[[https://github.com/miura/ijmacros/blob/master/PathStringManagement.js]]
  
 ==== Loading CSV file (data table) ==== ==== Loading CSV file (data table) ====
Line 64: Line 66:
 Note that line 21 uses java.lang.String class explicitly, for using endsWith() method in the line 22. Otherwise the string variable "filepath" is a type of JS string which does not have endsWith() method.   Note that line 21 uses java.lang.String class explicitly, for using endsWith() method in the line 22. Otherwise the string variable "filepath" is a type of JS string which does not have endsWith() method.  
    
-<sxh javascript>+<code javascript>
 // Example javascript for loading data from a series of CSV files in a folder. // Example javascript for loading data from a series of CSV files in a folder.
 //  // 
Line 115: Line 117:
     }         }    
 }     }    
-</sxh>+</code> 
 + 
 +[[https://github.com/miura/ijmacros/blob/master/CSVloader.js]] 
 + 
 +==== Saving CSV file (data table) ==== 
 + 
 +This example is in Jython (Python style Java scripting). 
 +<code python> 
 +from util.opencsv import CSVWriter 
 +from java.io import FileWriter 
 +from java.lang.reflect import Array 
 +from java.lang import String, Class 
 +  
 +writer = CSVWriter(FileWriter("c:/temp/testcsv.csv"), ','
 +data = Array.newInstance(Class.forName("java.lang.String"), 3) 
 +#String[] entries = "first#second#third".split("#"); 
 +data[0] = str(11) 
 +data[1] = str(23) 
 +data[2] = str(5555) 
 +writer.writeNext(data) 
 +writer.close() 
 +</code> 
 + 
 + 
 + 
 + 
 + 
 +===== Bitwise AND ===== 
 + 
 +Bitwise AND is often used as switching ON/OFF multiple options. For Example: 
 + 
 +<code javascript> 
 +DISPLAY_SUMMARY = 256; 
 +SHOW_ROI_MASKS = 4096; 
 +options = SHOW_ROI_MASKS + DISPLAY_SUMMARY; 
 +if ((options&SHOW_ROI_MASKS)!=0) 
 + IJ.log("SHOW_ROI_MASKS selected"); 
 +</code> 
 + 
 +Switching ON/OFF is controlled using 16bit binary a.k.a 16 digit binary number. 256 is  
 +<code> 
 +0000000100000000 
 +</code>  
 +9th digit from the right is "1", the place where ON/OFF of DISPLAY_SUMMARY is controlled.  
 +4096 is 
 +<code> 
 +0001000000000000 
 +</code> 
 +13th digit controls the ON/OFF of SHOW_ROI_MASKS. 
 +If you need to turn these options on,  
 +<code> 
 +0001000100000000 
 +</code> 
 +both 9th and 13th digits should be 1. To construct this binary number, it simply is: 
 +<code> 
 +256 + 4096 = 4352 
 +bin(4352) = 0001000100000000 
 +</code> 
 +To check if "options" (a number) contains SHOW_ROI_MASKS, one compares if corresponding digit (13th) is turned ON. To do so, we use Bitwise AND. 
 +<code> 
 +(0001000100000000) 
 +AND 
 +(0001000000000000) 
 + 
 +result: 0001000000000000 
 +</code> 
 +meaning that 
 +<code javascript> 
 +((options&SHOW_ROI_MASKS)!=0) 
 +</code> 
 +is true.
  
-[[https://github.com/cmci/ijmacros/blob/master/CSVloader.js]]+Above is a short example made for showing how to control ParticleAnalyzer options
  
 ===== Arguments of Function could be with Variable Length ===== ===== Arguments of Function could be with Variable Length =====
Line 123: Line 195:
 Javascript Function is a class that takes variable length of arguments. Even if there is no arguments declared in the function, one could add ones in runtime and could be retrieved from inside the function using Functions object 'Arguments'. Javascript Function is a class that takes variable length of arguments. Even if there is no arguments declared in the function, one could add ones in runtime and could be retrieved from inside the function using Functions object 'Arguments'.
  
-<sxh javascript>+<code javascript>
 // normal way of writing function  // normal way of writing function 
 function add01(a, b) { function add01(a, b) {
Line 151: Line 223:
 IJ.log(sum(1, 2, 3)); // prints 6 IJ.log(sum(1, 2, 3)); // prints 6
 IJ.log(sum(1, 2, 3, 4, 5, 6)); // prints 21 IJ.log(sum(1, 2, 3, 4, 5, 6)); // prints 21
-</sxh> +</code>
 ===== Writing Values in the Results Table ===== ===== Writing Values in the Results Table =====
  
-<sxh javascript>+<code javascript>
 rt = ResultsTable(); rt = ResultsTable();
 for (var i = 0; i < 10; i++){ for (var i = 0; i < 10; i++){
Line 163: Line 234:
 } }
 rt.show("Results"); rt.show("Results");
-</sxh>+</code>
  
 +===== Aborting the script =====
  
 +To abort the running script, use the following function. 
 +I got this from [[http://vikku.info/codesnippets/javascript/forcing-javascript-to-abort-stop-javascript-execution-at-any-time/|here]]. 
 +<code javascript>
 +function javascript_abort(){
 +   throw new Error('This is not an error. This is just to abort javascript');
 +}</code>
 ===== Arrays ===== ===== Arrays =====
  
Line 174: Line 252:
 For some array treatments, this matters a lot and keeping your arrays either Java array or Javascript array is pretty important. Below is an example of Java > javascript array conversion and also how to check the object type. For constructing Java array in javascript, [[http://pacific.mpi-cbg.de/wiki/index.php/Javascript_Scripting#Native_Java_arrays|see here]].  For some array treatments, this matters a lot and keeping your arrays either Java array or Javascript array is pretty important. Below is an example of Java > javascript array conversion and also how to check the object type. For constructing Java array in javascript, [[http://pacific.mpi-cbg.de/wiki/index.php/Javascript_Scripting#Native_Java_arrays|see here]]. 
    
-<sxh javascript>+<code javascript>
 //as an example, you first get an array from  //as an example, you first get an array from 
 //Results table in ImageJ.  //Results table in ImageJ. 
Line 191: Line 269:
 IJ.log("sliceA class: " + Object.prototype.toString.call(sliceA)); IJ.log("sliceA class: " + Object.prototype.toString.call(sliceA));
 IJ.log("sliceJSA class: " + Object.prototype.toString.call(sliceJSA)); IJ.log("sliceJSA class: " + Object.prototype.toString.call(sliceJSA));
-</sxh>+</code>
 ==== Sorting Numerical Array ==== ==== Sorting Numerical Array ====
-<sxh javascript>+<code javascript>
 //prepare some data //prepare some data
 data = [10.0, 100.0, -1.0, 9.0, 200.0, 1.0]; data = [10.0, 100.0, -1.0, 9.0, 200.0, 1.0];
Line 215: Line 293:
 IJ.log(data.valueOf()); //prints -1,1,9,10,100,200 IJ.log(data.valueOf()); //prints -1,1,9,10,100,200
  
-</sxh>+</code>
  
 ==== Sorting a List of Numbered Files ==== ==== Sorting a List of Numbered Files ====
Line 235: Line 313:
 Such sorting could be done by combining regular expression matching. Such sorting could be done by combining regular expression matching.
  
-<sxh javascript>+<code javascript>
 importPackage(java.io); importPackage(java.io);
 path = "c:\\files"; path = "c:\\files";
Line 259: Line 337:
  return (regexa[1] - regexb[1])   return (regexa[1] - regexb[1]) 
 } }
-</sxh>+</code>
  
 Above code will then prints out: Above code will then prints out:
Line 281: Line 359:
  
 I thought of Math.max(array.valueOf()) seemingly should work, but it doesn't. It should be like this: I thought of Math.max(array.valueOf()) seemingly should work, but it doesn't. It should be like this:
-<sxh javascript>+<code javascript>
 var testa = Array(); var testa = Array();
  
Line 293: Line 371:
 IJ.log("Minimum value: " + minval); IJ.log("Minimum value: " + minval);
 IJ.log("Maximum value: " + maxval); IJ.log("Maximum value: " + maxval);
-</sxh>+</code>
  
 This is because Math.min and Math.max methods only takes individual numbers, not an array. To unpack an array, apply() method of class Function is used. An example below depicts its usage.  This is because Math.min and Math.max methods only takes individual numbers, not an array. To unpack an array, apply() method of class Function is used. An example below depicts its usage. 
  
-<sxh javascript> +<code javascript> 
 var sum = function(){ var sum = function(){
   var result = 0;   var result = 0;
Line 314: Line 392:
 ans = sum.apply(sum, data02); ans = sum.apply(sum, data02);
 IJ.log(ans); IJ.log(ans);
-</sxh>+</code>
  
 ... I mean if you want to sum up, you don't really have to be bulky but method apply() has so many flexibility in applying methods to any objects.  ... I mean if you want to sum up, you don't really have to be bulky but method apply() has so many flexibility in applying methods to any objects. 
Line 322: Line 400:
 Use Array.forEach(function) method.  Use Array.forEach(function) method. 
  
-<sxh javascript>+<code javascript>
 data = [10.0, 100.0, -1.0, 9.0, 200.0, 1.0]; data = [10.0, 100.0, -1.0, 9.0, 200.0, 1.0];
  
Line 336: Line 414:
    IJ.log('['+idx+'] = '+ Math.pow(x,2));    IJ.log('['+idx+'] = '+ Math.pow(x,2));
 } }
-</sxh>+</code>
  
 Output: Output:
Line 362: Line 440:
 map() function is convenient if you want to have an output array after processing each element.  map() function is convenient if you want to have an output array after processing each element. 
  
-<sxh javascript>+<code javascript>
 // this will be an example array // this will be an example array
 xA = [5, 25, 75, 100]; xA = [5, 25, 75, 100];
Line 386: Line 464:
 IJ.log(array.join()); //prints 20,100,300,400 IJ.log(array.join()); //prints 20,100,300,400
  
-</sxh>+</code>
  
 ==== Slicing Multidimensional Array ==== ==== Slicing Multidimensional Array ====
Line 394: Line 472:
 If you know one, please tell me. What supposed to be something like v1 = allA[:, 1] in Python would be much easier.  If you know one, please tell me. What supposed to be something like v1 = allA[:, 1] in Python would be much easier. 
  
-<sxh javascript>+<code javascript>
 //multidimensional array slicing //multidimensional array slicing
  
Line 430: Line 508:
  return a[id][this.sliceindex];  return a[id][this.sliceindex];
 } }
-</sxh>+</code>
  
 ==== Matrix Transpose ==== ==== Matrix Transpose ====
  
 An application of vertical slicing, matrix transposition.  An application of vertical slicing, matrix transposition. 
-<sxh javascript>+<code javascript>
 //transposing data matrix //transposing data matrix
  
Line 465: Line 543:
 2,5,8 2,5,8
 */ */
-</sxh>+</code>
  
 ===== Windows ===== ===== Windows =====
 +
 +==== Duplicating current Results table with different title ====
 +
 +<code js>
 +ResultsTable.getResultsTable().clone().show("duplicated");
 +</code>
  
 ==== Activating / Deactivating BatchMode ==== ==== Activating / Deactivating BatchMode ====
Line 473: Line 557:
 To suppress creation of image windows, you could activate BatchMode. Corresponding function in ImageJ is setBatchMode(true) and setBatchMode(false). To suppress creation of image windows, you could activate BatchMode. Corresponding function in ImageJ is setBatchMode(true) and setBatchMode(false).
  
-<sxh javascript>+<code javascript>
 importClass(Packages.ij.macro.Interpreter); importClass(Packages.ij.macro.Interpreter);
 macro = new Interpreter();  macro = new Interpreter(); 
Line 494: Line 578:
 //deactivate batchmode //deactivate batchmode
 macro.batchMode = false; macro.batchMode = false;
-</sxh>+</code>
  
  
 ==== Closing All Image Windows ==== ==== Closing All Image Windows ====
  
-<sxh javascript>+<code javascript>
 function imagewinKiller(){ function imagewinKiller(){
  var wins = WindowManager.getIDList();  var wins = WindowManager.getIDList();
Line 505: Line 589:
  WindowManager.getImage(wins[i]).close();  WindowManager.getImage(wins[i]).close();
 } }
-</sxh>+</code>
  
 ==== Adding Mouse Listener to an Image ==== ==== Adding Mouse Listener to an Image ====
  
-<sxh javascript>+<code javascript>
 // example of implementing and extending java interface // example of implementing and extending java interface
  
Line 532: Line 616:
 win.getCanvas().addMouseMotionListener(mouseListener); win.getCanvas().addMouseMotionListener(mouseListener);
  
-</sxh>+</code> 
 + 
 +As of 20131120, above code works with "Run" in Fiji script editor, but it DOES NOT work if you save the script as a file and run it using [Macro > Plugins > Run]. This probably is caused by the difference in javascript engine version: Fiji script editor uses jar/js.jar, but the latter method uses JS evaluator packaged with JRE. Following code works with [Macro > Plugins > Run...]. Difference is that the constructor for JavaAdaptor in this case uses two arguments, rather than three arguments. This problem was pointed out by Torsten Stöter (Uni. Magdeburg) and following fix was contributed by him. Thanks to Torsten! 
 + 
 +<code javascript> 
 +var mouseListener = new JavaAdapter(MouseListener, /*MouseMotionListener,*/
 +    mouseClicked: function(event) { 
 +        IJ.log("clicked" + " (" + event.getX() + "," + event.getY() + ")"); 
 +    }, 
 +    mouseDragged: function(event) { 
 +        IJ.log("dragged"); 
 +    }, 
 +    mouseMoved: function(event) { 
 +    } 
 +}); 
 +</code>
  
 ==== Adding Overlays to an Image ==== ==== Adding Overlays to an Image ====
Line 539: Line 638:
 For drawing Arrows, use commented out lines. For drawing Arrows, use commented out lines.
  
-<sxh javascript>+<code javascript>
 overlayLine(10, 10, 40, 40); overlayLine(10, 10, 40, 40);
 overlayLine(40, 40, 10, 70); overlayLine(40, 40, 10, 70);
Line 565: Line 664:
 //IJ.log("head " + roi1.getDefaultWidth()); //IJ.log("head " + roi1.getDefaultWidth());
 } }
-</sxh>+</code>
  
 ===== Image Processing ===== ===== Image Processing =====
Line 571: Line 670:
 ==== Creating a Partial Stack of an Original Stack with shared ImageProcessor objects ==== ==== Creating a Partial Stack of an Original Stack with shared ImageProcessor objects ====
  
-<sxh javascript>+<code javascript>
 function alias2frames(imp, i){ function alias2frames(imp, i){
  var stack = imp.getStack();  var stack = imp.getStack();
Line 580: Line 679:
  return imp2   return imp2
 } }
-</sxh+</code
  
 ==== Background Subtraction by ImageMath ==== ==== Background Subtraction by ImageMath ====
  
-<sxh javascript>+<code javascript>
 //Example Javascript for Background substraction using ImageMath  //Example Javascript for Background substraction using ImageMath 
 // Kota Miura (miura@embl.de) // Kota Miura (miura@embl.de)
Line 602: Line 701:
  ic.run("Subtract", imp, blurrimp);  ic.run("Subtract", imp, blurrimp);
 } }
-</sxh>+</code>
  
-[[https://github.com/cmci/ijmacros/blob/master/ImageMath.js]]+[[https://github.com/miura/ijmacros/blob/master/ImageMath.js]]
  
 ==== Batch Trainable Segmentation using Trained Data ==== ==== Batch Trainable Segmentation using Trained Data ====
  
-<sxh javascript>+<code javascript>
 // Example script for using trainable segmentation // Example script for using trainable segmentation
 // -- assumes that an extra plugin by Kota is installed // -- assumes that an extra plugin by Kota is installed
Line 625: Line 724:
 binimp = dbt.runsilent(); binimp = dbt.runsilent();
 binimp.show(); binimp.show();
-</sxh>+</code>
  
-[[https://github.com/cmci/ijmacros/blob/master/TrainableSegmentationByTrained.js]]+[[https://github.com/miura/ijmacros/blob/master/TrainableSegmentationByTrained.js]] 
 + 
 +Another version without using the plugin above.  
 +<code javascript> 
 +importClass(Packages.trainableSegmentation.WekaSegmentation); 
 +imp = IJ.getImage(); 
 +ws = WekaSegmentation(imp); 
 +ws.loadTrainingData('C:\\t\\data.arff'); 
 +if (ws.trainClassifier()){ 
 + impout = ws.getClassifiedImage(); 
 + if (impout == null)  
 + IJ.log("failed retrieving output"); 
 + else { 
 + impout.show(); 
 +
 +}  
 +</code>
  
 ==== Using 3D processor plugin ==== ==== Using 3D processor plugin ====
Line 633: Line 748:
 3D processing generally consumes long long time for calculation, so better been done silently and headlessly. Here is one recipe using [[http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:3d_binary_morphological_filters:start|3D processor plugin]], which could be a good hint for doing it in headless (batch) mode. Does not use IJ.rin method, so ImagePlus instance is handed over explicitly.  3D processing generally consumes long long time for calculation, so better been done silently and headlessly. Here is one recipe using [[http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:3d_binary_morphological_filters:start|3D processor plugin]], which could be a good hint for doing it in headless (batch) mode. Does not use IJ.rin method, so ImagePlus instance is handed over explicitly. 
  
-<sxh javascript>+%gist(1663061)% 
 + 
 +https://gist.github.com/miura/1663061 
 +<code:js>
 importClass(Packages.ij3d.image3d.IntImage3D); importClass(Packages.ij3d.image3d.IntImage3D);
 imp=IJ.getImage(); imp=IJ.getImage();
Line 641: Line 759:
 plus=new ImagePlus("localmaxima",ima2.getStack()); plus=new ImagePlus("localmaxima",ima2.getStack());
 plus.show(); plus.show();
-</sxh>+</code>
  
 ==== Transformation of 3D stack according to given landmark pairs ==== ==== Transformation of 3D stack according to given landmark pairs ====
Line 647: Line 765:
 Works in Fiji. Note the use of JavaImporter() from line 12 to 15 for avoiding conflicts in name space.  Works in Fiji. Note the use of JavaImporter() from line 12 to 15 for avoiding conflicts in name space. 
  
-<sxh javascript>+<code javascript>
 //  affinetransform3D.js //  affinetransform3D.js
 //  Created: 201107120 by Kota Miura (CMCI, EMBL miura@embl.de) //  Created: 201107120 by Kota Miura (CMCI, EMBL miura@embl.de)
Line 765: Line 883:
   transM.preConcatenate(shift);   transM.preConcatenate(shift);
 } }
-</sxh>+</code>
  
-[[https://github.com/cmci/ijmacros/blob/master/affinetransform3Dv2.js]]+[[https://github.com/miura/ijmacros/blob/master/affinetransform3Dv2.js]]
  
 ==== 3D tracking of spots, and plotting of the resulted spots in a new Stack ==== ==== 3D tracking of spots, and plotting of the resulted spots in a new Stack ====
  
-<sxh javascript>+<code javascript>
 /* /*
 * script for creating a stack with same size of the current stack, and plot xyz dots listed in results window.\ * script for creating a stack with same size of the current stack, and plot xyz dots listed in results window.\
Line 812: Line 930:
 } }
 imp2.show(); imp2.show();
-</sxh>+</code>
  
-[[https://github.com/cmci/ijmacros/blob/master/3Ddots.js]]+[[https://github.com/miura/ijmacros/blob/master/3Ddots.js]]
  
 ===== Math ===== ===== Math =====
Line 821: Line 939:
  
 Below is an example of calculating statistical values using Apache Commons Math library (already included in Fiji). There are many more you could do with it so explore the API.   Below is an example of calculating statistical values using Apache Commons Math library (already included in Fiji). There are many more you could do with it so explore the API.  
-<sxh javascript>+<code javascript>
 //first example, using static methods "StatUtils" //first example, using static methods "StatUtils"
 importClass(Packages.org.apache.commons.math.stat.StatUtils); importClass(Packages.org.apache.commons.math.stat.StatUtils);
Line 848: Line 966:
 IJ.log(mean); IJ.log(mean);
 IJ.log(std); IJ.log(std);
-</sxh>+</code>
  
 ==== 3D vector ==== ==== 3D vector ====
  
 Using 3D vector class in apache commons math.  Using 3D vector class in apache commons math. 
-<sxh javascript>+<code javascript>
 importClass(Packages.org.apache.commons.math.geometry.euclidean.threed.Vector3D); importClass(Packages.org.apache.commons.math.geometry.euclidean.threed.Vector3D);
  
Line 877: Line 995:
 vd = va.crossProduct(vb); vd = va.crossProduct(vb);
 IJ.log("" + vd.getX()+ "," + vd.getY()+ "," + vd.getZ()); IJ.log("" + vd.getX()+ "," + vd.getY()+ "," + vd.getZ());
-</sxh>+</code>
  
 ==== Solving Quadratic Formula ==== ==== Solving Quadratic Formula ====
Line 884: Line 1002:
 [[http://code.garyjones.co.uk/category/javascript/]] [[http://code.garyjones.co.uk/category/javascript/]]
  
-<sxh javascript>+<code javascript>
 //Solving quadratic formula //Solving quadratic formula
 /** /**
Line 942: Line 1060:
  return lambda; // Returns either root based on parameter "root" passed to function.  return lambda; // Returns either root based on parameter "root" passed to function.
 } }
-</sxh>+</code>
  
-[[https://github.com/cmci/ijmacros/blob/master/roiProfileGaussFitterV3.js]]+[[https://github.com/miura/ijmacros/blob/master/roiProfileGaussFitterV3.js]]
  
 ==== Gaussian fitting of Intensity Profile ==== ==== Gaussian fitting of Intensity Profile ====
Line 952: Line 1070:
 Note Line 18 and 19, where type conversion between Java array and javascript array is done.  Note Line 18 and 19, where type conversion between Java array and javascript array is done. 
  
-<sxh javascript>+<code javascript>
 // cf: class CurveFitter // cf: class CurveFitter
 // cfp: fitted parameter array // cfp: fitted parameter array
Line 993: Line 1111:
   return resA;     return resA;  
 } }
-</sxh>+</code>
  
-[[https://github.com/cmci/ijmacros/blob/master/roiProfileGaussFitterV3.js]]+[[https://github.com/miura/ijmacros/blob/master/roiProfileGaussFitterV3.js]]
  
  
Line 1002: Line 1120:
 3DViewer has many capability in plotting 3D scenes, including time series.  3DViewer has many capability in plotting 3D scenes, including time series. 
 Api is available at [[http://132.187.25.13/ij3d/download/docs/index.html|here]]. Examples could be found in the [[http://3dviewer.neurofly.de/|website]].  Api is available at [[http://132.187.25.13/ij3d/download/docs/index.html|here]]. Examples could be found in the [[http://3dviewer.neurofly.de/|website]]. 
 +
 +==== Checking Java3D version ====
 +
 +Version of Java3D is a critical issue for programming 3DViewer. Since upgrading Java does not in many cases means automatic upgrading of Java3D in your Java extension folder, this could be a problem during development. Here is a way to check your Java3D version.
 +
 +%gist(1663134)%
 +[gist cmci/1663134]
  
 ==== Plotting Mesh shapes: an example with tubes ==== ==== Plotting Mesh shapes: an example with tubes ====
Line 1008: Line 1133:
 It seems that there will be newer class called [[http://fiji.sc/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/3D_Viewer/customnode/Tube.java;h=674156cee4131181336c36a6a65cdb2c807f510d;hb=HEAD|customnode.Tube]] becoming available soon (as of 20111219). Since Point3d class is directly used in this new class, I will replace the code below, but this old one might still is informative as an example of using Java array.  It seems that there will be newer class called [[http://fiji.sc/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/3D_Viewer/customnode/Tube.java;h=674156cee4131181336c36a6a65cdb2c807f510d;hb=HEAD|customnode.Tube]] becoming available soon (as of 20111219). Since Point3d class is directly used in this new class, I will replace the code below, but this old one might still is informative as an example of using Java array. 
  
-<sxh javascript>+<code javascript>
 // test for Mesh_Maker,createTube // test for Mesh_Maker,createTube
  
Line 1046: Line 1171:
 } }
  
-</sxh>+</code>
 [{{ :documents:figure20111219:figure20111219:track2frames.gif?250| Plotting of tracks}}] [{{ :documents:figure20111219:figure20111219:track2frames.gif?250| Plotting of tracks}}]
documents/110822jsip_cooking/javascript_imagej_cookbook.1324347534.txt.gz · Last modified: 2016/05/24 12:46 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki