![]() | ![]() |
![]() |
Previous Message |
Next Message Previous in Topic | Next in Topic Previous by Same Author | Next by Same Author Previous Page (February 2001) | Back to Main IMAGEJ Page | | ![]()
Reply
| Post a New Message |
Join or Leave IMAGEJ, or Change Options
|
Search | ![]()
Chronologically |
Most Recent First |
Wrap Text (Proportional Font) |
Don't Wrap Text (Non-proportional Font) | ![]() |
References: <[log in to unmask]> Content-Type: multipart/alternative; Message-ID: <v04205506b6b602bfab0a@[192.168.0.1]> Date: Sun, 18 Feb 2001 18:05:38 -0500 Reply-To: ImageJ Interest Group <[log in to unmask]> Sender: ImageJ Interest Group <[log in to unmask]> From: Bill Christens-Barry <[log in to unmask]> Subject: using invertLUT() in plugin? In-Reply-To: <[log in to unmask]>I've been trying to invert the LUT of 16-bit grayscale images in a plugin without success. Can anyone give me a lead or example on how to do this? In particular, I have the following plugin (a variant of the 'Batch_processor.java' plugin that is on the ImageJ site): /************ Batch_ORO.java **************/ /************ scales, smooths, and rotates ORO gels correctly **************/ import ij.plugin.*; import java.awt.*; import java.io.*; import ij.*; import ij.io.*; import ij.process.*; import ij.gui.*; public class Batch_ORO implements PlugIn { private static String[] choices = {"Tiff","Jpeg", "Zip", "Raw"}; private static String format = "Tiff"; public void run(String arg) { OpenDialog od = new OpenDialog("Select a file in source folder...", ""); if (od.getFileName()==null) return; String dir1 = od.getDirectory(); SaveDialog sd = new SaveDialog("Open destination folder...", "Navigate and hit <ok>", ""); if (sd.getFileName()==null) return; String dir2 = sd.getDirectory(); convert(dir1, dir2, format); } public void convert(String dir1, String dir2, String format) { IJ.write(""); IJ.write("Converting to "+format); IJ.write("dir1: "+dir1); IJ.write("dir2: "+dir2); String[] list = new File(dir1).list(); if (list==null) return; for (int i=0; i<list.length; i++) { IJ.write((i+1)+": "+list[i]); IJ.showStatus(i+"/"+list.length); File f = new File(dir1+list[i]); if (!f.isDirectory()) { ImagePlus img = new Opener().openImage(dir1, list[i]); if (img!=null) { img = process(img); if (img!=null) save(img, dir2, format); } } } IJ.showProgress(1.0); IJ.showStatus(""); } /** This is the place to add code to process each image. The image is not written if this method returns null. */ v { double xscale = 0.5392; double yscale = 1.4825; int width = img.getWidth(); int height = img.getHeight(); ImageProcessor ip = img.getProcessor(); ip.setInterpolate(true); ip = ip.resize((int)(width*xscale), (int)(height*yscale)); img.setProcessor(null, ip); ip.rotate(-90); xscale = 0.6400; yscale = 0.5600; width = img.getWidth(); height = img.getHeight(); ip.setInterpolate(true); ip = ip.resize((int)(width*xscale), (int)(height*yscale)); img.setProcessor(null, ip); ip.smooth(); ip.smooth(); return img; } public void save(ImagePlus img, String dir, String format) { String name = img.getTitle(); int type = img.getType(); int dotIndex = name.lastIndexOf("."); if (dotIndex>=0) name = name.substring(0, dotIndex); String path = dir + name; new FileSaver(img).saveAsTiff(path+"jo.tif"); } /** Run Batch_ORO using a command something like "java -cp ij.jar;. Batch_ORO c:\dir1\ c:\dir2\" */ public static void main(String args[]) { if (args.length<2) IJ.write("usage: java Batch_ORO srcdir dstdir"); else new Batch_ORO ().convert(args[0], args[1], "Jpeg"); } } I'd like to do the LUT inversion, using the invertLUT() method. I've tried using a command ip.inverLUT(); after the smoothing operations in the public ImagePlus process(ImagePlus img) method (where other image manipulations are done), but I get an error to the saying that /Muchachos/NIH Image/ImageJ 1.20s/plugins/Processing/Batch_ORO.java:71: Method invertLUT() not found in class ij.process.ImageProcessor. ip.invertLUT(); If I open the source in CodeWarrior, I see the method in ij.process. What am I failing to understand here? Thanks, Bill Christens-Barry ........................................................... .........*..................................*........... ......*......Bill Christens-Barry.....*...... .....*............................................*..... ......*[log in to unmask]*....... .........*..................................*........... ...........................................................
[text/enriched]I've been trying to invert the LUT of 16-bit grayscale images in a plugin without success. Can anyone give me a lead or example on how to do this? In particular, I have the following plugin (a variant of the 'Batch_processor.java' plugin that is on the ImageJ site): <fontfamily><param>Geneva</param>/************ Batch_ORO.java **************/ /************ scales, smooths, and rotates ORO gels correctly **************/ import ij.plugin.*; import java.awt.*; import java.io.*; import ij.*; import ij.io.*; import ij.process.*; import ij.gui.*; public class Batch_ORO implements PlugIn { private static String[] choices = {"Tiff","Jpeg", "Zip", "Raw"}; private static String format = "Tiff"; public void run(String arg) { OpenDialog od = new OpenDialog("Select a file in source folder...", ""); if (od.getFileName()==null) return; String dir1 = od.getDirectory(); SaveDialog sd = new SaveDialog("Open destination folder...", "Navigate and hit <<ok>", ""); if (sd.getFileName()==null) return; String dir2 = sd.getDirectory(); convert(dir1, dir2, format); } public void convert(String dir1, String dir2, String format) { IJ.write(""); IJ.write("Converting to "+format); IJ.write("dir1: "+dir1); IJ.write("dir2: "+dir2); String[] list = new File(dir1).list(); if (list==null) return; for (int i=0; i<<list.length; i++) { IJ.write((i+1)+": "+list[i]); IJ.showStatus(i+"/"+list.length); File f = new File(dir1+list[i]); if (!f.isDirectory()) { ImagePlus img = new Opener().openImage(dir1, list[i]); if (img!=null) { img = process(img); if (img!=null) save(img, dir2, format); } } } IJ.showProgress(1.0); IJ.showStatus(""); } /** This is the place to add code to process each image. The image is not written if this method returns null. */ v { double xscale = 0.5392; double yscale = 1.4825; int width = img.getWidth(); int height = img.getHeight(); ImageProcessor ip = img.getProcessor(); ip.setInterpolate(true); ip = ip.resize((int)(width*xscale), (int)(height*yscale)); img.setProcessor(null, ip); ip.rotate(-90); xscale = 0.6400; yscale = 0.5600; width = img.getWidth(); height = img.getHeight(); ip.setInterpolate(true); ip = ip.resize((int)(width*xscale), (int)(height*yscale)); img.setProcessor(null, ip); ip.smooth(); ip.smooth(); return img; } public void save(ImagePlus img, String dir, String format) { String name = img.getTitle(); int type = img.getType(); int dotIndex = name.lastIndexOf("."); if (dotIndex>=0) name = name.substring(0, dotIndex); String path = dir + name; new FileSaver(img).saveAsTiff(path+"jo.tif"); } /** Run Batch_ORO using a command something like "java -cp ij.jar;. Batch_ORO c:\dir1\ c:\dir2\" */ public static void main(String args[]) { if (args.length<<2) IJ.write("usage: java Batch_ORO srcdir dstdir"); else new Batch_ORO ().convert(args[0], args[1], "Jpeg"); } } </fontfamily>I'd like to do the LUT inversion, using the invertLUT() method. I've tried using a command ip.inverLUT(); after the smoothing operations in the <fontfamily><param>Geneva</param>public ImagePlus process(ImagePlus img)</fontfamily> method (where other image manipulations are done), but I get an error to the saying that <fontfamily><param>Geneva</param>/Muchachos/NIH Image/ImageJ 1.20s/plugins/Processing/Batch_ORO.java:71: Method invertLUT() not found in class ij.process.ImageProcessor. ip.invertLUT(); If I open the source in CodeWarrior, I see the method in ij.process. What am I failing to understand here? Thanks, Bill Christens-Barry </fontfamily> ........................................................... .........*..................................*........... ......*......Bill Christens-Barry.....*...... .....*............................................*..... ......*[log in to unmask]*....... .........*..................................*........... ...........................................................
![]() |
![]() Center for Information Technology National Institutes of Health Bethesda, Maryland 20892 301 594 6248 (v) 301 496 8294 (TDD) Comments and Assistance Accessibility ![]() |