use of gdsc.smlm.results.PeakResults in project GDSC-SMLM by aherbert.
the class PeakFit method addSingleFrameOverlay.
private void addSingleFrameOverlay() {
// If a single frame was processed add the peaks as an overlay if they are in memory
ImagePlus imp = this.imp;
if (fitMaxima && singleFrame > 0) {
if (source instanceof IJImageSource) {
String title = source.getName();
imp = WindowManager.getImage(title);
}
}
if (singleFrame > 0 && imp != null) {
MemoryPeakResults results = null;
for (PeakResults r : this.results.toArray()) if (r instanceof MemoryPeakResults) {
results = (MemoryPeakResults) r;
break;
}
if (results == null || results.size() == 0)
return;
ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.enableYesNoCancel();
gd.hideCancelButton();
gd.addMessage("Add the fitted localisations as an overlay?");
gd.showDialog();
if (!gd.wasOKed())
return;
LUT lut = LUTHelper.createLUT(LutColour.ICE);
Overlay o = new Overlay();
ArrayList<PeakResult> list = (ArrayList<PeakResult>) results.getResults();
for (int i = 0, j = results.size() - 1; i < results.size(); i++, j--) {
PeakResult r = list.get(i);
PointRoi roi = new PointRoi(r.getXPosition(), r.getYPosition());
Color c = LUTHelper.getColour(lut, j, results.size());
roi.setStrokeColor(c);
roi.setFillColor(c);
if (imp.getStackSize() > 1)
roi.setPosition(singleFrame);
o.add(roi);
}
imp.setOverlay(o);
imp.getWindow().toFront();
}
}
use of gdsc.smlm.results.PeakResults in project GDSC-SMLM by aherbert.
the class PulseActivationAnalysis method getImage.
private ImageProcessor getImage(PeakResultsList peakResultsList) {
PeakResults[] list = peakResultsList.toArray();
IJImagePeakResults image = (IJImagePeakResults) list[1];
return image.getImagePlus().getProcessor();
}
use of gdsc.smlm.results.PeakResults in project GDSC-SMLM by aherbert.
the class PeakFit method initialiseFitting.
/**
* Set-up the fitting using all the configured properties. Prepare the output results.
*/
public boolean initialiseFitting() {
if (source == null)
return false;
// Do this to ensure the serialised configuration is correct
updateFitConfiguration(config);
results.setSource(source);
if (maximaIdentification)
results.setName(source.getName() + " (Maxima)");
else if (fitMaxima)
results.setName(source.getName() + " (" + getSolverName() + " Fit Maxima)");
else
results.setName(source.getName() + " (" + getSolverName() + ")");
results.setBounds(bounds);
Calibration cal = calibration.clone();
// Account for the frame integration
// TODO - Should we change this so that if integrate frames is used then the data
// are converted to ExtendedPeakResult with a start and end frame
//cal.exposureTime *= integrateFrames;
//if (interlacedData)
//{
// cal.exposureTime *= ((double)dataBlock / (dataBlock + dataSkip));
//}
results.setCalibration(cal);
results.setConfiguration(XmlUtils.toXML(config));
addMemoryResults(results, false);
addImageResults(results);
addFileResults(results);
addTableResults(results);
addDefaultResults(results);
results.begin();
if (simpleFit && showImage) {
for (PeakResults r : results.toArray()) {
if (r instanceof IJImagePeakResults) {
ImagePlus i = ((IJImagePeakResults) r).getImagePlus();
Utils.log("Super-resolution image title = " + i.getTitle());
WindowManager.toFront(i.getWindow());
}
}
}
return true;
}
Aggregations