Commit d93caadd authored by Aliaksandr Halavatyi's avatar Aliaksandr Halavatyi

deleting outdated protocols

parent 15701cab
package feedback.fly.embryo.jobdistributors;
//import ij.Prefs;
import ij.gui.GenericDialog;
import ij.gui.WaitForUserDialog;
import ij.plugin.PlugIn;
import automic.online.jobdistributors.JobDistributor_Abstract;
import automic.online.jobs.common.Job_RecordFinish;
import automic.parameters.ParameterCollection;
import automic.parameters.gui.ParameterGuiManager;
import automic.table.TableModel;
import automic.table.TableProcessor;
import feedback.fly.embryo.jobs.Job_FocusEmbryoAuto;
import feedback.fly.embryo.jobs.Job_SelectMultipleEmbryosAuto;
import feedback.fly.embryo.jobs.Job_SelectMultipleEmbryosAutoInit;
public class JobDistributor_AutoSelectionMultiple extends JobDistributor_Abstract implements PlugIn {
//private static final String PREFS_PREFIX="feebback.fly.embryo";
private ParameterCollection manualTrackParameterCollectionSelect;
private ParameterCollection manualTrackParameterCollectionFocus;
@Override
protected void fillJobList(){
//Job_SelectRecordManual manualTrackJob=new Job_SelectRecordManual();
//manualTrackJob.parseInputParameterValues(manualTrackParameterCollection);
//manualTrackJob.setZInvert(invertZ);
Job_SelectMultipleEmbryosAutoInit job1=new Job_SelectMultipleEmbryosAutoInit();
ParameterCollection job1Parameters=job1.createJobParameters();
job1Parameters.setUndefinedValuesFromDefaults();
ParameterGuiManager pgManager=new ParameterGuiManager(job1Parameters);
try{
pgManager.refineParametersViaDialog("Parameters for embryo selection");
}catch(Exception _ex){
new WaitForUserDialog("error in parameter values");
}
job1.parseInputParameterValues(pgManager.getParameterCollection());
super.addImageJob(job1, "DE_1_", "LZ.Image", true);
Job_FocusEmbryoAuto job2=new Job_FocusEmbryoAuto();
ParameterCollection job2Parameters=job2.createJobParameters();
job2Parameters.setUndefinedValuesFromDefaults();
ParameterGuiManager pgManager2=new ParameterGuiManager(job2Parameters);
try{
pgManager2.refineParametersViaDialog("Parameters for embryo selection");
}catch(Exception _ex){
new WaitForUserDialog("error in parameter values");
}
job2.parseInputParameterValues(pgManager2.getParameterCollection());
super.addImageJob(job2, "TR1_1_", "Focus.Image", true);
super.addImageJob(Job_RecordFinish.class, "TR2_1_", "Result.Image", true);
}
@Override
protected TableModel constructTabModel(String _rpth){
TableModel outTbl=new TableModel(_rpth);
outTbl.addColumn("Date.Time");
outTbl.addFileColumns("LZ.Image", "IMG");
outTbl.addFileColumns("Focus.Image", "IMG");
outTbl.addFileColumns("Result.Image", "IMG");
outTbl.addValueColumn("Zoom.X", "NUM");
outTbl.addValueColumn("Zoom.Y", "NUM");
outTbl.addValueColumn("Focus.Z", "NUM");
outTbl.addValueColumn("Success", "BOOL");
outTbl.addRow(new Object[outTbl.getColumnCount()]);
return outTbl;
}
@Override
protected TableProcessor configureTableProcessor(TableModel _tModel)throws Exception{
TableProcessor tProcessor=new TableProcessor(_tModel);
tProcessor.addFileColumns("Selected.Embryo.LZ", "ROI");
return tProcessor;
}
@Override
protected void putProtocolPreferencesToDialog(GenericDialog _dialog){
manualTrackParameterCollectionSelect=new Job_SelectMultipleEmbryosAuto().createJobParameters();
manualTrackParameterCollectionFocus=new Job_FocusEmbryoAuto().createJobParameters();
//_dialog.addCheckbox(Job_SelectEmbryoManual.KEY_INVERT_Z, Prefs.getBoolean(generatePrefsKey(Job_SelectEmbryoManual.KEY_INVERT_Z),false));
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_LOCATION_X, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_X),1000), 0);
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_LOCATION_Y, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_Y),120), 0);
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS),2), 0);
}
@Override
protected void getProtocolPreferencesFromDialog(GenericDialog _dialog){
manualTrackParameterCollectionSelect.setUndefinedValuesFromDefaults();
manualTrackParameterCollectionFocus.setUndefinedValuesFromDefaults();
// boolean invertZ=_dialog.getNextBoolean();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_INVERT_Z, invertZ);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_INVERT_Z), invertZ);
//
// int locationX=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_LOCATION_X, locationX);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_X), invertZ);
//
// int locationY=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_LOCATION_Y, locationY);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_Y), invertZ);
//
// int zoomIterations=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS, zoomIterations);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS), invertZ);
}
@Override
protected boolean showDialogInDebugRun(){
return false;
}
@Override
protected void setDebugConfiguration(){
final String searchPath="C:/tempDat/AutoFRAP_test";
this.setGeneralOptions(searchPath, true, false);
this.fileExtension="czi";
manualTrackParameterCollectionSelect=new Job_SelectMultipleEmbryosAuto().createJobParameters();
manualTrackParameterCollectionSelect.setUndefinedValuesFromDefaults();
manualTrackParameterCollectionFocus=new Job_SelectMultipleEmbryosAuto().createJobParameters();
manualTrackParameterCollectionFocus.setUndefinedValuesFromDefaults();
}
// private String generatePrefsKey(String _key){
// return String.format("%s.%s",PREFS_PREFIX, _key);
// }
}
package feedback.fly.embryo.jobdistributors;
//import ij.Prefs;
import ij.gui.GenericDialog;
import ij.plugin.PlugIn;
import automic.online.jobdistributors.JobDistributor_Abstract;
import automic.online.jobs.common.Job_RecordFinish;
import automic.parameters.ParameterCollection;
import automic.table.TableModel;
import feedback.fly.embryo.jobs.Job_FocusEmbryoManual;
import feedback.fly.embryo.jobs.Job_SelectEmbryoManual;
public class JobDistributor_ManualSelection extends JobDistributor_Abstract implements PlugIn {
//private static final String PREFS_PREFIX="feebback.fly.embryo";
private ParameterCollection manualTrackParameterCollection;
@Override
protected void fillJobList(){
//Job_SelectRecordManual manualTrackJob=new Job_SelectRecordManual();
//manualTrackJob.parseInputParameterValues(manualTrackParameterCollection);
//manualTrackJob.setZInvert(invertZ);
super.addImageJob(Job_SelectEmbryoManual.class, "DE_1_", "LZ.Image", true);
super.addImageJob(Job_FocusEmbryoManual.class, "TR1_1_", "Focus.Image", true);
super.addImageJob(Job_RecordFinish.class, "TR2_1_", "Result.Image", true);
}
@Override
protected TableModel constructTabModel(String _rpth){
TableModel outTbl=new TableModel(_rpth);
outTbl.addColumn("Date.Time");
outTbl.addFileColumns("LZ.Image", "IMG");
outTbl.addFileColumns("Focus.Image", "IMG");
outTbl.addFileColumns("Result.Image", "IMG");
outTbl.addValueColumn("Zoom.X", "NUM");
outTbl.addValueColumn("Zoom.Y", "NUM");
outTbl.addValueColumn("Focus.Z", "NUM");
outTbl.addValueColumn("Success", "BOOL");
outTbl.addRow(new Object[outTbl.getColumnCount()]);
return outTbl;
}
@Override
protected void putProtocolPreferencesToDialog(GenericDialog _dialog){
manualTrackParameterCollection=new Job_SelectEmbryoManual().createJobParameters();
//_dialog.addCheckbox(Job_SelectEmbryoManual.KEY_INVERT_Z, Prefs.getBoolean(generatePrefsKey(Job_SelectEmbryoManual.KEY_INVERT_Z),false));
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_LOCATION_X, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_X),1000), 0);
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_LOCATION_Y, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_Y),120), 0);
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS),2), 0);
}
@Override
protected void getProtocolPreferencesFromDialog(GenericDialog _dialog){
// boolean invertZ=_dialog.getNextBoolean();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_INVERT_Z, invertZ);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_INVERT_Z), invertZ);
//
// int locationX=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_LOCATION_X, locationX);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_X), invertZ);
//
// int locationY=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_LOCATION_Y, locationY);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_Y), invertZ);
//
// int zoomIterations=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS, zoomIterations);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS), invertZ);
}
@Override
protected boolean showDialogInDebugRun(){
return false;
}
@Override
protected void setDebugConfiguration(){
final String searchPath="C:/tempDat/AutoFRAP_test";
this.setGeneralOptions(searchPath, true, false);
this.fileExtension="czi";
manualTrackParameterCollection=new Job_SelectEmbryoManual().createJobParameters();
manualTrackParameterCollection.setUndefinedValuesFromDefaults();
}
// private String generatePrefsKey(String _key){
// return String.format("%s.%s",PREFS_PREFIX, _key);
// }
}
package feedback.fly.embryo.jobdistributors;
//import ij.Prefs;
import ij.gui.GenericDialog;
import ij.plugin.PlugIn;
import automic.online.jobdistributors.JobDistributor_Abstract;
import automic.online.jobs.common.Job_RecordFinish;
import automic.parameters.ParameterCollection;
import automic.table.TableModel;
import feedback.fly.embryo.jobs.Job_FocusEmbryoManual;
import feedback.fly.embryo.jobs.Job_SelectMultipleEmbryosManual;
public class JobDistributor_ManualSelectionMultiple extends JobDistributor_Abstract implements PlugIn {
//private static final String PREFS_PREFIX="feebback.fly.embryo";
private ParameterCollection manualTrackParameterCollection;
@Override
protected void fillJobList(){
//Job_SelectRecordManual manualTrackJob=new Job_SelectRecordManual();
//manualTrackJob.parseInputParameterValues(manualTrackParameterCollection);
//manualTrackJob.setZInvert(invertZ);
super.addImageJob(Job_SelectMultipleEmbryosManual.class, "DE_1_", "LZ.Image", true);
super.addImageJob(Job_FocusEmbryoManual.class, "TR1_1_", "Focus.Image", true);
super.addImageJob(Job_RecordFinish.class, "TR2_1_", "Result.Image", true);
}
@Override
protected TableModel constructTabModel(String _rpth){
TableModel outTbl=new TableModel(_rpth);
outTbl.addColumn("Date.Time");
outTbl.addFileColumns("LZ.Image", "IMG");
outTbl.addFileColumns("Focus.Image", "IMG");
outTbl.addFileColumns("Result.Image", "IMG");
outTbl.addValueColumn("Zoom.X", "NUM");
outTbl.addValueColumn("Zoom.Y", "NUM");
outTbl.addValueColumn("Focus.Z", "NUM");
outTbl.addValueColumn("Success", "BOOL");
outTbl.addRow(new Object[outTbl.getColumnCount()]);
return outTbl;
}
@Override
protected void putProtocolPreferencesToDialog(GenericDialog _dialog){
manualTrackParameterCollection=new Job_SelectMultipleEmbryosManual().createJobParameters();
//_dialog.addCheckbox(Job_SelectEmbryoManual.KEY_INVERT_Z, Prefs.getBoolean(generatePrefsKey(Job_SelectEmbryoManual.KEY_INVERT_Z),false));
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_LOCATION_X, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_X),1000), 0);
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_LOCATION_Y, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_Y),120), 0);
//_dialog.addNumericField(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS, Prefs.getInt(generatePrefsKey(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS),2), 0);
}
@Override
protected void getProtocolPreferencesFromDialog(GenericDialog _dialog){
// boolean invertZ=_dialog.getNextBoolean();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_INVERT_Z, invertZ);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_INVERT_Z), invertZ);
//
// int locationX=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_LOCATION_X, locationX);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_X), invertZ);
//
// int locationY=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_LOCATION_Y, locationY);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_LOCATION_Y), invertZ);
//
// int zoomIterations=(int)_dialog.getNextNumber();
// manualTrackParameterCollection.setParameterValue(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS, zoomIterations);
// Prefs.set(generatePrefsKey(Job_SelectEmbryoManual.KEY_ZOOM_ITERATIONS), invertZ);
}
@Override
protected boolean showDialogInDebugRun(){
return false;
}
@Override
protected void setDebugConfiguration(){
final String searchPath="C:/tempDat/AutoFRAP_test";
this.setGeneralOptions(searchPath, true, false);
this.fileExtension="czi";
manualTrackParameterCollection=new Job_SelectMultipleEmbryosManual().createJobParameters();
manualTrackParameterCollection.setUndefinedValuesFromDefaults();
}
// private String generatePrefsKey(String _key){
// return String.format("%s.%s",PREFS_PREFIX, _key);
// }
}
package feedback.fly.embryo.jobs;
import java.awt.Color;
import java.awt.Polygon;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Point2D;
import java.io.File;
import java.util.concurrent.TimeUnit;
import automic.online.microscope.ZeissKeys;
import automic.online.jobs.Job_Default;
//import automic.utils.imagefiles.ImageOpenerWithBioformats;
import automic.parameters.ParameterCollection;
//import automic.parameters.ParameterType;
import ij.IJ;
import ij.ImageJ;
import ij.ImagePlus;
import ij.gui.ImageCanvas;
//import ij.gui.ImageWindow;
//import ij.gui.OvalRoi;
import ij.gui.Overlay;
import ij.gui.PointRoi;
import ij.gui.Roi;
import ij.gui.Toolbar;
//import ij.gui.WaitForUserDialog;
//import ij.plugin.Duplicator;
import loci.plugins.BF;
import loci.plugins.in.ImporterOptions;
public class Job_FocusEmbryoManual extends Job_Default{
//public static final String KEY_INVERT_Z="Invert Z position (piezo)";
//public static final String KEY_ZOOM_ITERATIONS="Zoom iterations";
//public static final String KEY_LOCATION_X="Window location X";
//public static final String KEY_LOCATION_Y="Window location Y";
//private static final Roi nullRoi=null;
private ImagePlus img=null;
private Roi selectedPoint;
private Integer selectedXPosition;
private Integer selectedYPosition;
private Integer selectedZPosition;
private Integer zSubmit;
private boolean selectionMade=false;
//private boolean invert_Z;
//private int zoomIterations;
//private int initialLocationX;
//private int initialLocationY;
class SelectionListener implements MouseListener{
@Override
public void mouseClicked(MouseEvent e) {
selectionMade=true;
//IJ.showMessage("Mouse clicked");
}
@Override
public void mousePressed(MouseEvent e) {}
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseEntered(MouseEvent e) {}
@Override
public void mouseExited(MouseEvent e) {}
}
@Override
protected void cleanIterOutput(){
img=null;
selectedPoint=null;
selectedXPosition=null;
selectedYPosition=null;
selectedYPosition=null;
zSubmit=null;
selectionMade=false;
}
@Override
protected void preProcessOnline()throws Exception{
//super.clearSharedData();
//curTbl.cleanRecord(curDInd);
currentTable.setFileAbsolutePath(newImgFile, curDInd, imgColumnNm, "IMG");
Integer zoomIndex=(Integer)getSharedValue("Zoom Counter");
zoomIndex++;
setSharedValue("Zoom Counter",zoomIndex);
Point2D.Double[] zoompts=(Point2D.Double[])this.getSharedValue("Zoom Points");
currentTable.setNumericValue(zoompts[zoomIndex].getX(), curDInd, "Zoom.X");
currentTable.setNumericValue(zoompts[zoomIndex].getY(), curDInd, "Zoom.Y");
//String Exper_nm=newImgFile.getName();
//Exper_nm=Exper_nm.substring(0, Exper_nm.indexOf(fileTag));
//this.setSharedValue("Experiment Name", Exper_nm);
//img=ImageOpenerWithBioformats.openImage(newImgFile);
TimeUnit.MILLISECONDS.sleep(3000);
img=openSelectedSlices(newImgFile);
}
@Override
protected void preProcessOffline()throws Exception{
//img=ImageOpenerWithBioformats.openImage(currentTable.getFile(curDInd, imgColumnNm, "IMG"));
img=openSelectedSlices(currentTable.getFile(curDInd, imgColumnNm, "IMG"));
}
private ImagePlus openSelectedSlices(File _imageFile)throws Exception{
ImporterOptions options = new ImporterOptions();
options.setAutoscale(true);
options.setId(_imageFile.getAbsolutePath());
//options.setCBegin(0, 2);
//options.setCEnd(0, 3);
//options.setTBegin(0, 0);
//options.setTEnd(0, 0);
return BF.openImagePlus(options)[0];
}
@Override
protected boolean runProcessing()throws Exception{
int nSlices=img.getNSlices();
//ImageWindow.setNextLocation(initialLocationX,initialLocationY);
//img=new Duplicator().run(img, 3, 4, 1, img.getNSlices(), 1, 1);
//img.setC(1);
//IJ.run(img, "Cyan", "");
//IJ.run(img, "Enhance Contrast", "saturated=0.35");
//img.setC(2);
//IJ.run(img, "Magenta", "");
//IJ.run(img, "Enhance Contrast", "saturated=0.35");
img.setDisplayMode(IJ.COMPOSITE);
img.show();
//for (int iterationIndex=0;iterationIndex<zoomIterations;iterationIndex++){
// IJ.run(img,"In [+]","");
//}
img.setZ(nSlices/2+1);
IJ.setTool(Toolbar.POINT);
SelectionListener selectionListener=new SelectionListener();
ImageCanvas imgCanvas=img.getCanvas();
imgCanvas.addMouseListener(selectionListener);
while(!selectionMade){
TimeUnit.MILLISECONDS.sleep(50);
}
imgCanvas.removeMouseListener(selectionListener);
//new WaitForUserDialog ("Select Shift Point").show();
selectedZPosition=img.getZ();
selectedPoint=img.getRoi();
if ( selectedPoint==null) return false;
if(!(selectedPoint instanceof PointRoi)) return false;
selectedPoint.setPosition(1, selectedZPosition, 1);
selectedPoint.setStrokeColor(Color.yellow);
//invert zPosition if required
zSubmit=selectedZPosition-1;//(invert_Z)?(nSlices-selectedZPosition):(selectedZPosition-1);
Polygon pointPolygon=selectedPoint.getPolygon();
selectedXPosition=pointPolygon.xpoints[0];
selectedYPosition=pointPolygon.ypoints[0];
img.hide();
return true;
}
@Override
protected Overlay createOverlay(){
return new Overlay();
}
@Override
public void visualise(int _xvis, int _yvis){
//this.visualiseImg(img, getOverlay(), _xvis, _yvis);
}
@Override
public void postProcessSuccess()throws Exception{
ZeissKeys.submitCommandsToMicroscope("trigger2", ""+selectedXPosition,""+selectedYPosition,""+zSubmit,"","","","","");
Roi saveRoi=null;
if(selectedXPosition!=null && selectedYPosition!=null){
saveRoi=new PointRoi(selectedXPosition, selectedYPosition);
//saveRoi=new OvalRoi(selectedXPosition-3, selectedYPosition-3, 6, 6);
saveRoi.setPosition(0,selectedZPosition,0);
}
saveRoiForImage(newImgFile,saveRoi);
//currentTable.setNumericValue(selectedXPosition, curDInd, "Pos.X");