Commit ed4eebc9 authored by Aliaksandr Halavatyi's avatar Aliaksandr Halavatyi
Browse files

cleaning procedures for line and frame acquisitions

parent 6db677b6
......@@ -14,7 +14,7 @@
-->
<groupId>embl.almf</groupId>
<artifactId>AutoMicTools_</artifactId>
<version>1.1.16-SNAPSHOT</version>
<version>1.1.17-SNAPSHOT</version>
<name>plugins/AutoMicTools_.jar</name>
<description>Collection of tools for automated (feedback) microscopy data acquisition and analysis</description>
......
......@@ -8,7 +8,6 @@ import automic.online.jobs.Job_Default;
import automic.online.microscope.ZeissLSM800;
import automic.utils.imagefiles.ImageOpenerWithBioformats;
import automic.utils.roi.ROIManipulator2D;
import ij.IJ;
import ij.ImageJ;
import ij.ImagePlus;
import ij.ImageStack;
......@@ -16,8 +15,6 @@ import ij.gui.Line;
import ij.gui.Overlay;
import ij.gui.ProfilePlot;
import ij.gui.Roi;
import imagescience.transform.Turn;
import imagescience.image.Image;
public class Job_AutofocusInit_ZenBlue extends Job_Default{
//private static final Roi nullRoi=null;
......@@ -44,6 +41,7 @@ public class Job_AutofocusInit_ZenBlue extends Job_Default{
Exper_nm=Exper_nm.substring(0, Exper_nm.indexOf(fileTag));
this.setSharedValue("Experiment Name", Exper_nm);
TimeUnit.MILLISECONDS.sleep(1000);
ImageOpenerWithBioformats.turnLineScans=true;
img=ImageOpenerWithBioformats.openImage(newImgFile);
isLineScan=(img.getWidth()==1)||(img.getHeight()==1);
}
......@@ -51,21 +49,51 @@ public class Job_AutofocusInit_ZenBlue extends Job_Default{
@Override
protected void preProcessOffline()throws Exception{
//img=ImageOpenerWithBioformats.openImage(currentTable.getFile(curDInd, imgColumnNm, "IMG"));
ImageOpenerWithBioformats.turnLineScans=true;
img=ImageOpenerWithBioformats.openImage(newImgFile);
isLineScan=(img.getWidth()==1)||(img.getHeight()==1);
}
@Override
protected boolean runProcessing()throws Exception{
if (isLineScan)
maxind=getFocusValueLine(img);
else {
maxind=getFocusValueFrameStack(img);
}
return true;
}
private int getFocusValueLine(ImagePlus _image) {
//find focus and send to the microscope macro
_image.setRoi(0,0,_image.getWidth(), _image.getHeight());
double [] vals=new ProfilePlot(_image,true).getProfile();
_image.setRoi((Roi)null);
int npoints=vals.length;
double maxv=0;
int max_id=-1;
for (int i=0;i<npoints;i++){
if (vals[i]>maxv){
max_id=i;
maxv=vals[i];
}
}
return max_id;
}
private int getFocusValueFrameStack(ImagePlus _image) {
//find focus and send to the microscope macro
//img.setRoi(0,0,img.getWidth(), img.getHeight());
//double [] vals=new ProfilePlot(img,true).getProfile();
//img.setRoi((Roi)null);
//int npoints=vals.length;
_image.setRoi((Roi)null);
/*
double maxv=0;
maxind=-1;
int max_id=-1;
ImageStack stack=img.getStack();
int nSlices=stack.getSize();
......@@ -74,40 +102,21 @@ public class Job_AutofocusInit_ZenBlue extends Job_Default{
for (int i=0;i<nSlices;i++){
currentValue=stack.getProcessor(i+1).getStatistics().mean;
if (currentValue>maxv){
maxind=i;
max_id=i;
maxv=currentValue;
}
}
//ln=new Line(0,maxind,img.getWidth(),maxind);
//ln.setStrokeColor(Color.ORANGE);
*/
//find focus and send to the microscope macro
img.setRoi(0,0,img.getWidth(), img.getHeight());
double [] vals=new ProfilePlot(img,true).getProfile();
img.setRoi((Roi)null);
int npoints=vals.length;
double maxv=0;
maxind=-1;
for (int i=0;i<npoints;i++){
if (vals[i]>maxv){
maxind=i;
maxv=vals[i];
}
}
return max_id;
return true;
}
@Override
protected Overlay createOverlay(){
Overlay o=new Overlay();
//if(isLineScan&&(maxind>0))
if(maxind>0)
if(isLineScan&&(maxind>0))
o.add(new Line(0, maxind, img.getWidth()-1, maxind));
return o;
}
......@@ -115,18 +124,10 @@ public class Job_AutofocusInit_ZenBlue extends Job_Default{
@Override
public void visualise(int _xvis, int _yvis){
this.visualiseImg(img, getOverlay(), _xvis, _yvis);
/*
if (isLineScan) {
ImagePlus transformedImage=new Turn().run(Image.wrap(img), 0, 0, 1).imageplus();//img.duplicate();
IJ.run(transformedImage, "TransformJ Turn", "z-angle=0 y-angle=0 x-angle=90");
this.visualiseImg(transformedImage, getOverlay(), _xvis, _yvis);
}else{
this.visualiseImg(img, getOverlay(), _xvis, _yvis);
if (maxind>0)
img.setSlice(maxind);
if ((!isLineScan) && (maxind>0)) {
img.setSlice(maxind);
}
*/
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment