Search in sources :

Example 66 with ImagePlus

use of ij.ImagePlus in project TrakEM2 by trakem2.

the class PatchStack method decacheAll.

/**
 * Remove all awts and snaps from the loader's cache, and repaint (which will remake as many as needed)
 */
public void decacheAll() {
    // record already flushed imps, since there can be shared imps among Patch instances (for example in stacks)
    final HashSet<ImagePlus> hs = new HashSet<ImagePlus>();
    final Loader loader = patch[currentSlice - 1].getProject().getLoader();
    for (int i = 0; i < patch.length; i++) {
        ImagePlus imp = loader.fetchImagePlus(patch[i]);
        if (hs.contains(imp))
            continue;
        else if (null != imp)
            hs.add(imp);
        loader.decache(imp);
        loader.flushMipMaps(patch[i].getId());
        Display.repaint(patch[i].getLayer(), patch[i], 0);
    }
}
Also used : Loader(ini.trakem2.persistence.Loader) ImagePlus(ij.ImagePlus) HashSet(java.util.HashSet)

Example 67 with ImagePlus

use of ij.ImagePlus in project TrakEM2 by trakem2.

the class PatchStack method invertLookupTable.

public void invertLookupTable() {
    Loader loader = patch[currentSlice - 1].getProject().getLoader();
    ImagePlus imp = loader.fetchImagePlus(patch[currentSlice - 1]);
    imp.getProcessor().invert();
    Display.repaint(patch[currentSlice - 1].getLayer(), patch[currentSlice - 1], 0);
    // TODO if the database updates are too much, then one could put a "save" button somewhere that shows as "unsaved" (red?) when there are unsaved changes.
    patch[currentSlice - 1].updateInDatabase("tiff_working");
    // just saved
    imp.changes = false;
}
Also used : Loader(ini.trakem2.persistence.Loader) ImagePlus(ij.ImagePlus)

Example 68 with ImagePlus

use of ij.ImagePlus in project TrakEM2 by trakem2.

the class PatchStack method getProcessor.

public ImageProcessor getProcessor() {
    ImagePlus imp = patch[currentSlice - 1].getProject().getLoader().fetchImagePlus(patch[currentSlice - 1]);
    ImageProcessor ip = imp.getProcessor();
    if (null != this.roi)
        imp.setRoi(this.roi);
    called[currentSlice - 1] = true;
    return ip;
}
Also used : ImageProcessor(ij.process.ImageProcessor) ImagePlus(ij.ImagePlus)

Example 69 with ImagePlus

use of ij.ImagePlus in project TrakEM2 by trakem2.

the class PatchStack method setProperty.

public void setProperty(String key, Object value) {
    ImagePlus imp = patch[currentSlice - 1].getProject().getLoader().fetchImagePlus(patch[currentSlice - 1]);
    imp.setProperty(key, value);
    // TODO same as above, may be too much saving
    patch[currentSlice - 1].updateInDatabase("tiff_working");
// patch[currentSlice-1].getProject().getLoader().vacuum();
}
Also used : ImagePlus(ij.ImagePlus)

Example 70 with ImagePlus

use of ij.ImagePlus in project TrakEM2 by trakem2.

the class PatchStack method killRoi.

public void killRoi() {
    if (null != roi) {
        saveRoi();
        roi = null;
    }
    // .fetchImagePlus(patch[currentSlice-1]);
    ImagePlus imp = patch[currentSlice - 1].getProject().getLoader().getCachedImagePlus(patch[currentSlice - 1].getId());
    if (null != imp)
        imp.killRoi();
// draw() // not needed
}
Also used : ImagePlus(ij.ImagePlus)

Aggregations

ImagePlus (ij.ImagePlus)363 ImageStack (ij.ImageStack)85 ImageProcessor (ij.process.ImageProcessor)74 Rectangle (java.awt.Rectangle)60 ArrayList (java.util.ArrayList)46 IOException (java.io.IOException)40 File (java.io.File)36 Roi (ij.gui.Roi)32 Point (java.awt.Point)32 ByteProcessor (ij.process.ByteProcessor)29 FormatException (loci.formats.FormatException)29 GenericDialog (ij.gui.GenericDialog)27 Calibration (ij.measure.Calibration)26 FloatProcessor (ij.process.FloatProcessor)22 Future (java.util.concurrent.Future)22 ExtendedGenericDialog (uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)22 LinkedList (java.util.LinkedList)21 ExecutorService (java.util.concurrent.ExecutorService)19 MemoryPeakResults (uk.ac.sussex.gdsc.smlm.results.MemoryPeakResults)19 PointRoi (ij.gui.PointRoi)17