Commit 0c2aca3c authored by gonciarz's avatar gonciarz

Some imporovements for reading from text files

parent bf99b91a
......@@ -26,7 +26,7 @@ public class Particle {
public float nonParticleDiscriminationScore = 0;
// linking stuff
public boolean special = true; // a flag that is used while detecting and linking particles
public boolean special = true; // a flag that is pused while detecting and linking particles
public int[] next = null; // array that holds in position i the next particle number in frame i
public float distance = -1;
public float lx, ly, lz; // previous Linking x,y,z
......@@ -173,7 +173,42 @@ public class Particle {
public double getSize() {
return m0;
}
public void setm0(double aM) {
m0 = (float) aM;
}
public double getm0() {
return m0;
}
public void setm1(double aM) {
m1 = (float) aM;
}
public double getm1() {
return m1;
}
public void setm2(double aM) {
m2 = (float) aM;
}
public double getm2() {
return m2;
}
public void setm3(double aM) {
m3 = (float) aM;
}
public double getm3() {
return m3;
}
public void setm4(double aM) {
m4 = (float) aM;
}
public double getm4() {
return m4;
}
// ------------------------------------------------------------------------
// CSV definitions and setters/getters used when reading Squassh output
// TODO: this is terrible solution, it should be handled differently
......
......@@ -371,7 +371,7 @@ public class MosaicUtils {
final Cursor<T> img_c = B.cursor();
final RandomAccessibleInterval<T> view = Views.hyperSlice(A, B.numDimensions(), fix);
final Cursor<T> img_v = Views.iterable(view).cursor();
final Cursor<T> img_v = Views.flatIterable(view).cursor();
while (img_c.hasNext()) {
img_c.fwd();
......
......@@ -21,7 +21,6 @@ public class Utils {
*/
public static HistogramWindow plotHistogram(String aTitle, double[] aValues, int aNumOfBins) {
final FloatProcessor hist = new FloatProcessor(aValues.length, 1, aValues);
System.out.println("HISTOGRAM..");
return new ij.gui.HistogramWindow(aTitle, new ImagePlus(aTitle, hist), aNumOfBins);
}
......
......@@ -124,6 +124,13 @@ public class CSV<E> {
setDelimiter(';');
numOfColumns = tempNumOfColumns;
}
else {
tempNumOfColumns = map[0].split("\t").length;
if (tempNumOfColumns > 1) {
setDelimiter('\t');
numOfColumns = tempNumOfColumns;
}
}
}
}
catch (final IOException e) {
......
......@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
import org.junit.Before;
import org.junit.Test;
......@@ -16,6 +18,7 @@ import org.supercsv.cellprocessor.ParseDouble;
import org.supercsv.cellprocessor.ParseInt;
import org.supercsv.cellprocessor.ift.CellProcessor;
import mosaic.core.detection.Particle;
import mosaic.test.framework.CommonBase;
public class CSVTest extends CommonBase {
......@@ -472,4 +475,15 @@ public class CSVTest extends CommonBase {
expectedData.add(new TestThing(4, 99.1));
assertEquals(expectedData, outdst);
}
@Test
public void removeME() {
final CSV<Particle> P_csv = new CSV<Particle>(Particle.class);
P_csv.setCSVPreferenceFromFile("/Volumes/GONCIARZ//Results.xls");
final Vector<Particle> p = P_csv.Read("/Volumes/GONCIARZ//Results.xls", null);
mosaic.utils.Debug.print(p.size(), p.get(0));
}
}
Markdown is supported
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