User Tools

Site Tools


documents:201021ijmacrofragments

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:201021ijmacrofragments [2020/10/26 16:40] kotadocuments:201021ijmacrofragments [2021/12/07 09:09] (current) kota
Line 1: Line 1:
 +
 ====== ImageJ Macro Fragments ====== ====== ImageJ Macro Fragments ======
  
Line 5: Line 6:
 ===== Getting the number of Cores ===== ===== Getting the number of Cores =====
  
-<code>+<sxh js>
 th = eval("script","Runtime.getRuntime().availableProcessors();"); th = eval("script","Runtime.getRuntime().availableProcessors();");
 print(th); print(th);
-</code>+</sxh> 
 + 
 +===== Loading ROIs from a file in Internet ===== 
 + 
 +shell command "curl" should be available in your local machine. [[https://help.ubidots.com/en/articles/2165289-learn-how-to-install-run-curl-on-windows-macosx-linux|See here for installation]].  
 + 
 +<sxh js> 
 +run("Blobs (25K)"); 
 +path = getDirectory('imagej')+"RoiSet.zip"; 
 +print(path) 
 +exec("curl", "-LJO", "https://github.com/mutterer/weird/raw/master/RoiSet.zip", "--output", path); 
 +roiManager("Open",path); 
 +roiManager("Show All"); 
 +File.delete(path); 
 +</sxh> 
 + 
 +===== Getting Pixel Coordinates within a Polygon ROI ===== 
 + 
 +<sxh js> 
 +Roi.getContainedPoints(xps, yps);  
 +for(i=0; i<xps.length; i++) { 
 + xpos = xps[i]; 
 + ypos = yps[i]; 
 + pixval = getPixel(xpos, ypos); 
 + print("("+ xpos + ", " + ypos + ") ", pixval); 
 +
 +</sxh> 
  
 ===== Ways of getting the file basename ===== ===== Ways of getting the file basename =====
-<code>+<sxh js>
 filepath = "/my/path/to/great_image.tif"; filepath = "/my/path/to/great_image.tif";
  
Line 33: Line 61:
 print(".... parent: ", parent); print(".... parent: ", parent);
  
-</code>+</sxh>
  
 ===== Convert black pixels to white in RGB image ===== ===== Convert black pixels to white in RGB image =====
  
-<code>+<sxh js>
 for (j =0; j<getHeight();j++){ for (j =0; j<getHeight();j++){
  for (i=0; i<getWidth();i++){  for (i=0; i<getWidth();i++){
Line 66: Line 94:
     return bf;             return bf;        
 }  }
-</code>+</sxh>
documents/201021ijmacrofragments.1603730422.txt.gz · Last modified: 2020/10/26 16:40 by kota

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki