close an image with scripting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

close an image with scripting

zoom
Hi, I'm trying to close an image with the close() command but it just says me that

Traceback (most recent call last):
  File "<iostream>", line 22, in <module>
NameError: name 'close' is not defined

the code is this one
import os
import ij


ll = os.listdir("/temp/lordvader/prat/Swimming/Videos/Euglene(240p_H.264-AAC)/frames");
i=0;
for item in ll:
        print item
        #image = IJ.openImage('/temp/lordvader/prat/Swimming/Videos/Euglene(240p_H.264-AAC)/frames/'+item);
        imp = IJ.open("/temp/lordvader/prat/Swimming/Videos/Euglene(240p_H.264-AAC)/frames/"+item); #shows
        IJ.run("Enhance Contrast", "saturated=0.4");
        IJ.run("Bandpass Filter...", "filter_large=40 filter_small=3 suppress=None tolerance=5 autoscale saturate");
        IJ.run("Sharpen");
        IJ.run("Find Edges");
        IJ.run("Despeckle");
        IJ.makeRectangle(24, 20, 258, 23);
        #IJ.run("Level Sets", "method=[Active Contours] use_level_sets grey_value_threshold=50 distance_threshold=0.50 advection=2.20 propagation=1 curvature=1 grayscale=30 convergence=0.0050 region=outside");
        #fs = FileSaver(image);
        #fs.saveAsTiff("/temp/lordvader/prat/Swimming/Videos/Euglene(240p_H.264-AAC)/framestreated/"+str(i));
        IJ.save("/temp/lordvader/prat/Swimming/Videos/Euglene(240p_H.264-AAC)/framestreated/"+item);
        i=i+1;
        close();

I also have tried with IJ.close(), but it neither works
do you know what I'm doing wrong?
Reply | Threaded
Open this post in threaded view
|

Re: close an image with scripting

zoom
it's done with the command
IJ.run("Close");