Skip to content

Commit

Permalink
Updating Maars
Browse files Browse the repository at this point in the history
  • Loading branch information
Marie committed Jul 4, 2014
1 parent 2a974f7 commit 39611e2
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 75 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*.LOG

*~
73 changes: 0 additions & 73 deletions MaarsLib/Maars.LOG

This file was deleted.

1 change: 0 additions & 1 deletion MaarsLib/maars_config.txt

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Objects detection and robust tracking for cell biology
# Set of Fiji and Micro-manager plugin for biology analysis

1 change: 1 addition & 0 deletions maars_config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"SEGMENTATION_PARAMETERS":{"CHANNEL":"BF","NEW_MAX_WIDTH_FOR_CHANGE_SCALE":1500,"NEW_MAX_HEIGTH_FOR_CHANGE_SCALE":1500,"FRAME_NUMBER":1,"RANGE_SIZE_FOR_MOVIE":9.0,"STEP":0.3,"MEAN_GREY_VALUE":-177660.0,"SOLIDITY":0.84,"FILTER_MEAN_GREY_VALUE":true,"FILTER_SOLIDITY":true,"MINIMUM_CELL_AREA":9.0,"CELL_SIZE":3.0,"MAXIMUM_CELL_AREA":400.0},"EXPLORATION_PARAMETERS":{"X_FIELD_NUMBER":2,"Y_FIELD_NUMBER":3},"FLUO_ANALYSIS_PARAMETERS":{"FRAME_NUMBER":1,"RANGE_SIZE_FOR_MOVIE":7.0,"STEP":0.3,"SPOT_RADIUS":0.15,"FIND_BEST_MITOSIS_IN_FIELD":true,"SAVE_FLUORESCENT_MOVIES":true,"MAXIMUM_NUMBER_OF_SPOT":2,"CHANNEL":"CFP"},"MITOSIS_MOVIE_PARAMETERS":{"END_MOVIE_CONDITIONS":{"CONDITIONS":{"RELATIVE_SPINDLE_ANGLE":false,"TIME_LIMIT":true,"ABSOLUTE_MAXIMUM_SPINDLE_SIZE":false,"RELATIVE_MAXIMUM_SPINDLE_SIZE":true,"GROWING_SPINDLE":false},"VALUES":{"ABSOLUTE_MAXIMUM_SPINDLE_SIZE":10,"RELATIVE_SPINDLE_ANGLE":0,"TIME_LIMIT":20.0,"GROWING_SPINDLE":0.0010,"RELATIVE_MAXIMUM_SPINDLE_SIZE":2.0}},"START_MOVIE_CONDITIONS":{"CONDITIONS":{"ABSOLUTE_MINIMUM_SPINDLE_SIZE":true,"ABSOLUTE_MAXIMUM_SPINDLE_SIZE":true,"RELATIVE_SPINDLE_ANGLE":false},"VALUES":{"RELATIVE_SPINDLE_ANGLE":90,"ABSOLUTE_MAXIMUM_SPINDLE_SIZE":5.0,"ABSOLUTE_MINIMUM_SPINDLE_SIZE":0.5}},"FRAME_NUMBER":1000,"MARGIN_AROUD_CELL":5,"TIME_INTERVAL":10000.0,"RANGE_SIZE_FOR_MOVIE":4.0,"CHANNEL":["GFP","CFP"],"STEP":0.3,"SAVING_PATH":"D:/Data/Marie/mutant57/test1/"},"GENERAL_ACQUISITION_PARAMETERS":{"CHANNEL_GROUP":"Illumination","DEFAULT_CHANNEL_PARAMATERS":{"BF":{"COLOR":"WHITE","EXPOSURE":30,"SHUTTER":"TIDiaLamp"},"GFP":{"COLOR":"GREEN","EXPOSURE":200,"SHUTTER":"Spectra"},"CFP":{"COLOR":"CYAN","EXPOSURE":200,"SHUTTER":"Spectra"},"DAPI":{"COLOR":"BLUE","EXPOSURE":100,"SHUTTER":"Spectra"},"TxRed":{"COLOR":"RED","EXPOSURE":200,"SHUTTER":"Spectra"}}}}
139 changes: 139 additions & 0 deletions testMaarsLib.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
//addClassPath("/home/marie/workspace/MaarsLib/MaarsLib.jar");
addClassPath("C:/Program Files/Micro-Manager-1.4/jars/MaarsLib.jar");
import MaarsLib.*;
import MaarsLib.MaarsMainDialog;
import MaarsLib.AllMaarsParameters;
import MaarsLib.ExplorationXYPositions;
import mmcorej.*;
import org.micromanager.api.*;
import ij.*;
import java.io.IOException;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

double calibration = gui.getMMCore().getPixelSizeUm();
mmc.setAutoShutter(false);
mmc.waitForDevice(mmc.getShutterDevice());

gui.message("Create main window");
MaarsMainDialog md = null;
try {
//md = new MaarsMainDialog(gui, mmc, "/home/marie/workspace/MaarsLib/");
md = new MaarsMainDialog(gui, mmc, "D:/Data/marie/");
} catch (IOException e) {
gui.message("Error");
}

gui.message("Show main window");

md.show();

while(md.isVisible()) {
gui.sleep(1000);
}
start = System.currentTimeMillis();
gui.message("start "+start);
if(md.isOkClicked()) {

AllMaarsParameters param = null;
autofocus = gui.getAutofocus();
param = md.getParameters();
mmc.setOriginXY(mmc.getXYStageDevice());
int nbXField = param
.getParametersAsJsonObject()
.get(AllMaarsParameters.EXPLORATION_PARAMETERS)
.getAsJsonObject()
.get(AllMaarsParameters.X_FIELD_NUMBER)
.getAsInt();
int nbYField = param
.getParametersAsJsonObject()
.get(AllMaarsParameters.EXPLORATION_PARAMETERS)
.getAsJsonObject()
.get(AllMaarsParameters.Y_FIELD_NUMBER)
.getAsInt();

gui.message("nb x field "+nbXField+" nb y field "+nbYField);


ExplorationXYPositions explo = new ExplorationXYPositions(nbXField,
nbYField,
(double) mmc.getImageWidth()*calibration,
(double) mmc.getImageHeight()*calibration);

for (int i = 0; i < explo.length(); i++) {
gui.message("x : "+explo.getX(i)+" y : "+explo.getY(i));

gui.setXYStagePosition(explo.getX(i),explo.getY(i));

MaarsAcquisitionForSegmentation mas = new MaarsAcquisitionForSegmentation(md,
explo.getX(i),
explo.getY(i));

mas.setupParameters();

mmc.waitForDevice(mmc.getXYStageDevice());

autofocus.fullFocus();

mas.acquire(false);

MaarsSegmentation ms = new MaarsSegmentation(param, mas.getPathToMovie()+"\\MMStack.ome.tif");
ms.segmentation();
while(ms.isAnalysing()) {
gui.sleep(3000);
}

MaarsFluoAnalysis mfa = new MaarsFluoAnalysis(param, ms.getSegmentationObject());
MaarsAcquisitionMitosis mmad = new MaarsAcquisitionMitosis(md, mfa, explo.getX(i), explo.getY(i));


mfa.getSetOfCells().shuffle();

MaarsAcquisitionForFluoAnalysis mafa = new MaarsAcquisitionForFluoAnalysis(md,
explo.getX(i),
explo.getY(i),
mfa.getSetOfCells());
if(param
.getParametersAsJsonObject()
.get(AllMaarsParameters.FLUO_ANALYSIS_PARAMETERS)
.getAsJsonObject()
.get(AllMaarsParameters.FIND_BEST_MITOSIS_IN_FIELD)
.getAsBoolean()) {

String acqNameFluo = "movie_X"
+Math.round(explo.getX(i))
+"_Y"+Math.round(explo.getY(i))
+"FLUO";

ImagePlus fluoImage = mafa.acquire(false, acqNameFluo);
int cellNumber = mfa.analyzeEntireField(fluoImage, mas.getPathToMovie());
if (cellNumber != -1) {
mmad.acquire(false, cellNumber, true, true);
}
}
else {
int j = 0;
boolean mitosis = false;
while(j < mfa.getSetOfCells().length() && !mitosis) {
ImagePlus fluoImage = mafa.acquire(false, j);
fluoImage.show();
if (mfa.checkStartConditions(mfa.getSpindle(fluoImage, j))) {
gui.message("mitosis");
mmad.acquire(true, j, false); //don't crop image because it is already cropped
mitosis = true;
}
j++;
}
}
// close roi manager
mfa.getSetOfCells().closeRoiManager();
mas.setupParameters();
}
}

mmc.setAutoShutter(true);
mmc.waitForDevice(mmc.getShutterDevice());
gui.message("end "+System.currentTimeMillis());
gui.message("it took "+(System.currentTimeMillis()-start));
gui.message("DONE");
gui.message("DONE.");

0 comments on commit 39611e2

Please sign in to comment.