Skip to content

Commit

Permalink
v.1.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Nov 16, 2022
1 parent 3e7c667 commit 343b5ae
Show file tree
Hide file tree
Showing 11 changed files with 324 additions and 126 deletions.
17 changes: 0 additions & 17 deletions LICENSE.txt~

This file was deleted.

13 changes: 0 additions & 13 deletions README.md~

This file was deleted.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>sc.fiji</groupId>
<artifactId>DoM_</artifactId>
<version>1.2.4</version>
<version>1.2.5</version>

<name>DoM_Utrecht</name>
<description>Detection of Molecules plugin for ImageJ</description>
Expand Down
Binary file renamed release/DoM_-1.2.4.jar → release/DoM_-1.2.5.jar
Binary file not shown.
46 changes: 23 additions & 23 deletions src/main/java/fiji/plugin/DOM/DOMConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@

public interface DOMConstants {

public static final String DOMversion="1.2.4";
public static final String DOMversion="1.2.5";

public static final double FITRADIUS=3.0;

//order of results column in the table
public static final int Col_X=0;
public static final int Col_Y=1;
public static final int Col_FrameN=2;
public static final int Col_Xnm=3;
public static final int Col_loc_errX=4;
public static final int Col_Ynm=5;
public static final int Col_loc_errY=6;
public static final int Col_Znm=7;
public static final int Col_loc_errZ=8;
public static final int Col_AmplFit=9;
public static final int Col_Amp_error=10;
public static final int Col_BGfit=11;
public static final int Col_BGfit_error=12;
public static final int Col_SD_X=13;
public static final int Col_SD_X_err=14;
public static final int Col_SD_Y=15;
public static final int Col_SD_Y_err=16;
public static final int Col_Fp=17;
public static final int Col_IntegrInt=18;
public static final int Col_SNR=19;
public static final int Col_chi=20;
public static final int Col_IterN=21;
public static int Col_X=0;
public static int Col_Y=1;
public static int Col_FrameN=2;
public static int Col_Xnm=3;
public static int Col_loc_errX=4;
public static int Col_Ynm=5;
public static int Col_loc_errY=6;
public static int Col_Znm=7;
public static int Col_loc_errZ=8;
public static int Col_AmplFit=9;
public static int Col_Amp_error=10;
public static int Col_BGfit=11;
public static int Col_BGfit_error=12;
public static int Col_SD_X=13;
public static int Col_SD_X_err=14;
public static int Col_SD_Y=15;
public static int Col_SD_Y_err=16;
public static int Col_Fp=17;
public static int Col_IntegrInt=18;
public static int Col_SNR=19;
public static int Col_chi=20;
public static int Col_IterN=21;

public static final int Col_TrackID=22;
public static final int Col_ParticleID=23;
Expand Down
59 changes: 34 additions & 25 deletions src/main/java/fiji/plugin/DOM/Import_MTrackJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ public class Import_MTrackJ implements PlugIn {

double [] trackid;
double [] patid;
double [] tracklength;
long nPatNumber;
//double [] tracklength;
//long nPatNumber;

SMLAnalysis sml_import = new SMLAnalysis();
SMLAnalysis smlImport = new SMLAnalysis();
@Override
public void run(String arg) {

String filename;
long nPatNumber;
IJ.register(Import_MTrackJ.class);

//if the function is called from macro and filename already provided
Expand All @@ -39,8 +40,9 @@ public void run(String arg) {
return;

filename = path+dgLoadMTrackJ.getFileName();

sml_import.ptable.reset();
IJ.log(" --- DoM plugin version " + DOMConstants.DOMversion+ " --- ");
IJ.log("Loading MTrackJ file: "+filename);
smlImport.ptable.reset();
nPatNumber = 0;
int nTrackN = 0;
int nParticleN = 0;
Expand All @@ -61,15 +63,15 @@ public void run(String arg) {
{
nParticleN++;
nPatNumber++;
sml_import.ptable.incrementCounter();
sml_import.ptable.addValue("Abs_frame", (int)Float.parseFloat(line_array[5]));
sml_import.ptable.addValue("X_(px)", Float.parseFloat(line_array[2]));
sml_import.ptable.addValue("Y_(px)", Float.parseFloat(line_array[3]));
sml_import.ptable.addValue("Channel", (int)Float.parseFloat(line_array[6]));
sml_import.ptable.addValue("Slice", (int)Float.parseFloat(line_array[5]));
sml_import.ptable.addValue("Frame", (int)Float.parseFloat(line_array[5]));
sml_import.ptable.addValue("Track_ID", nTrackN);
sml_import.ptable.addValue("Particle_ID", nParticleN);
smlImport.ptable.incrementCounter();
smlImport.ptable.addValue("Abs_frame", (int)Float.parseFloat(line_array[5]));
smlImport.ptable.addValue("X_(px)", Float.parseFloat(line_array[2]));
smlImport.ptable.addValue("Y_(px)", Float.parseFloat(line_array[3]));
smlImport.ptable.addValue("Channel", (int)Float.parseFloat(line_array[6]));
smlImport.ptable.addValue("Slice", (int)Float.parseFloat(line_array[5]));
smlImport.ptable.addValue("Frame", (int)Float.parseFloat(line_array[5]));
smlImport.ptable.addValue("Track_ID", nTrackN);
smlImport.ptable.addValue("Particle_ID", nParticleN);
}
}

Expand All @@ -84,25 +86,29 @@ public void run(String arg) {
}


calculate_Tracks_Lengths();
add_Tracks_Lengths();
sml_import.showTable();
//calculate_Tracks_Lengths();
add_Tracks_Lengths(smlImport,calculate_Tracks_Lengths(smlImport));
smlImport.showTable();
IJ.log("Done loading "+Long.toString(nPatNumber)+" particles.");
}

}


//function calculating the number of detected particles per track
void calculate_Tracks_Lengths()
public static double [] calculate_Tracks_Lengths(final SMLAnalysis sml_import)
{
int nCount,i;
int nCurrTrack, nMaxVal, nIniPosition;
long nPatNumber;

double [] trackid = sml_import.ptable.getColumnAsDoubles(6);
double [] patid = sml_import.ptable.getColumnAsDoubles(7);
nPatNumber = patid.length;

tracklength = new double [(int) nPatNumber];
double [] tracklength = new double [(int) nPatNumber];

trackid = sml_import.ptable.getColumnAsDoubles(6);
patid = sml_import.ptable.getColumnAsDoubles(7);

nMaxVal = 0;
nCurrTrack = (int) trackid[0];
nIniPosition = 0;
Expand Down Expand Up @@ -134,16 +140,19 @@ void calculate_Tracks_Lengths()
}

}

return tracklength;

}
//function adding the number of detected particles per track to results table
void add_Tracks_Lengths()
public static void add_Tracks_Lengths(final SMLAnalysis sml_import, final double [] tracklength)
{
int nCount;
//adding to final table
//init new column
sml_import.ptable.setValue("Track_Length", 0, tracklength[0]);
for(nCount = 1; nCount<nPatNumber; nCount++)

//add all stuff
for(nCount = 1; nCount<tracklength.length; nCount++)
sml_import.ptable.setValue(8, nCount, tracklength[nCount]);

}
Expand Down
109 changes: 109 additions & 0 deletions src/main/java/fiji/plugin/DOM/Import_TrackMate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package fiji.plugin.DOM;



import java.io.FileInputStream;
import java.io.InputStream;

import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;

import ij.IJ;
import ij.Prefs;
import ij.gui.GenericDialog;
import ij.plugin.PlugIn;

public class Import_TrackMate implements PlugIn {


SMLAnalysis sml_import = new SMLAnalysis();

@Override
public void run(String arg) {

String sFilename;
long nPatNumber=0;

IJ.register(Import_TrackMate.class);
sFilename=IJ.getFilePath("Open TrackMate XML file");
if (sFilename==null)
return;
if(sFilename.endsWith(".xml"))
{
GenericDialog dgImportTM = new GenericDialog("Import of Trackmate results");
dgImportTM.addNumericField("Pixel size of original image", Prefs.get("SiMoLoc.TMImportdPixelSize", 1.0), 2, 4, "units");
dgImportTM.showDialog();

if (dgImportTM.wasCanceled())
return;
double dPxSize = dgImportTM.getNextNumber();
Prefs.set("SiMoLoc.TMImportdPixelSize", dPxSize);

IJ.log(" --- DoM plugin version " + DOMConstants.DOMversion+ " --- ");
IJ.log("Loading TrackMate file:"+sFilename);
IJ.log("Original image pixel size:"+Double.toString(dPxSize));
try
{
int nTrack = 0;
int nFrame;
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
InputStream in = new FileInputStream(sFilename);
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(in);
int nPoint = 0;
while (streamReader.hasNext())
{
if (streamReader.isStartElement())
{
switch (streamReader.getLocalName())
{
case "Tracks":
{
IJ.log("Loading total of: " + streamReader.getAttributeValue(0) + " tracks... ");
sml_import.ptable.reset();

break;
}
case "particle":
{
nPoint =1;
nTrack = nTrack + 1;
break;
}
case "detection":
{
nPatNumber++;
nFrame = Integer.parseInt(streamReader.getAttributeValue(0))+1;
sml_import.ptable.incrementCounter();
sml_import.ptable.addValue("Abs_frame", nFrame);
sml_import.ptable.addValue("X_(px)", Float.parseFloat(streamReader.getAttributeValue(1))/dPxSize);
sml_import.ptable.addValue("Y_(px)", Float.parseFloat(streamReader.getAttributeValue(2))/dPxSize);
sml_import.ptable.addValue("Channel", 1);
sml_import.ptable.addValue("Slice", nFrame);
sml_import.ptable.addValue("Frame", nFrame);
sml_import.ptable.addValue("Track_ID", nTrack);
sml_import.ptable.addValue("Particle_ID", nPoint);
nPoint++;
break;
}
}
}
streamReader.next();
}
}
catch (Exception em)
{
IJ.log("Error reading "+sFilename);
IJ.log(em.getMessage());
}

Import_MTrackJ.add_Tracks_Lengths(sml_import,Import_MTrackJ.calculate_Tracks_Lengths(sml_import));
sml_import.showTable();
IJ.log("Done loading "+Long.toString(nPatNumber)+" particles.");
}
else
{
IJ.error("Not a TrackMate XML file");
}
}

}
2 changes: 1 addition & 1 deletion src/main/java/fiji/plugin/DOM/Link_Particles.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ else if (imp.getType() != ImagePlus.GRAY8 && imp.getType() != ImagePlus.GRAY16 )
//adding tracks to overlay
if(dlg.bShowTracks)
{
smlLink.addTracksToOverlay();
smlLink.addTracksToOverlay(true);
}
//adding particles to overlay
if(dlg.bShowParticlesLink)
Expand Down
Loading

0 comments on commit 343b5ae

Please sign in to comment.