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);
}
}
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;
}
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;
}
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();
}
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
}
Aggregations