logo       


setbatchmode exception and saving with a suffix: msg#00119

Subject: setbatchmode exception and saving with a suffix
There are two problems with the following macro that batch processes a
folder of 8 bit 2560x1920 grayscale .tifs and produces binary
thresholded output:

// run("Tiff...", "save=["+path+"]") requires V 1.33t, 13 December 2004

macro 'Image Enhancement [4]' {
       dir = getDirectory("Choose a Directory ");
       list = getFileList(dir);
       start = getTime();
       setBatchMode(true);
       thd=getNumber("You should already know the appropriate threshold. ENTER
IT NOW", 112);
       for (i=0; i<list.length; i++) {
               path = dir+list[i];
               open(path);
               title = getTitle();
               run("Enhance Contrast", "saturated=2 normalize");
               run("Median...", "radius=2"); // median filter replaces pixel 
with
median of neighbors - removes noise
               run("Sharpen");
               run("Median...", "radius=2");
               run("Subtract...", "value=1"); // so white (255) is thresholded
               setThreshold(thd, 255);
                       run("Apply LUT");
               run("Fill Holes");
               run("Watershed");
               run("Tiff...", "save=["+path+"]");
               num= i+1;
               tot= list.length;
               print ("image= "+title+"... "+num+" of "+tot+"_bin");
               //selectImage(title); NEEDED WITH SETBATCHMODE?
               //run("Close"); ; NEEDED WITH SETBATCHMODE?
       }
print("The macro took this many seconds...")
print((getTime()-start)/1000);
}


PROBLEM #1 -
If setBatchMode(true)is commented out, the macro runs with no problems.
However, using setBatchMode(true) gives the following exception, and
the macro doesn't run correctly:
java.lang.NullPointerException
 at ij.plugin.filter.EDM.doWatershed(EDM.java:534)
 at ij.plugin.filter.EDM.run(EDM.java:55)
 at ij.IJ.runFilterPlugIn(IJ.java:179)
 at ij.IJ.runPlugIn(IJ.java:111)
 at ij.Executer.runPlugIn(Executer.java:168)
 at ij.Executer.runCommand(Executer.java:131)
 at ij.Executer.run(Executer.java:63)
 at ij.IJ.run(IJ.java:311)
 at ij.IJ.run(IJ.java:288)
 at ij.macro.Functions.doRun(Functions.java:458)
 at ij.macro.Functions.doFunction(Functions.java:53)
 at ij.macro.Interpreter.doStatement(Interpreter.java:186)
 at ij.macro.Interpreter.doBlock(Interpreter.java:493)
 at ij.macro.Interpreter.doStatement(Interpreter.java:222)
 at ij.macro.Interpreter.doFor(Interpreter.java:439)
 at ij.macro.Interpreter.doStatement(Interpreter.java:204)
 at ij.macro.Interpreter.doBlock(Interpreter.java:493)
 at ij.macro.Interpreter.runMacro(Interpreter.java:101)
 at ij.macro.MacroRunner.run(MacroRunner.java:67)
 at java.lang.Thread.run(Unknown Source)

I think it's crashing at the watershedding step.

PROBLEM #2 -
I'm probably missing something obvious here.  I'd like to save the
binary file that is produced by the macro with a
_bin suffix, so the original .tif isn't clobbered.
run("Tiff...", "save=["+path+"]_bin");
doesn't work.

Thanks,
Ted Lewis

--
Ted Lewis
PhD Candidate
Climate System Research Center
Department of Geosciences
University of Massachusetts at Amherst
413-545-0659
http://www.geo.umass.edu/gradstud/lewist/



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe