Skip to content

Commit

Permalink
identified bug in the classification when parallelized... runs serial…
Browse files Browse the repository at this point in the history
… for now and also added support for other image types e.g. tiff, png, psd, pdf, tga, ico, sgi
  • Loading branch information
kapelner committed Feb 26, 2016
1 parent 2274bf3 commit 8f37e61
Show file tree
Hide file tree
Showing 40 changed files with 104 additions and 39 deletions.
27 changes: 24 additions & 3 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="commons-math-2.1.jar"/>
<classpathentry kind="lib" path="itext-1.4.8.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="executable/lib/commons-math-2.1.jar"/>
<classpathentry kind="lib" path="executable/lib/itext-1.4.8.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-common-image-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-common-io-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-common-lang-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-bmp-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-clippath-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-core-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-hdr-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-icns-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-iff-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-jpeg-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-metadata-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-pcx-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-pdf-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-pict-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-pnm-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-psd-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-reference-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-sgi-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-tga-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-thumbsdb-3.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="executable/lib/twelvemonkeys-imageio-tiff-3.3-SNAPSHOT.jar"/>
<classpathentry kind="output" path=""/>
</classpath>
1 change: 0 additions & 1 deletion GemIdentCentroidFinding/PostProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import GemIdentImageSets.ImageAndScoresBank;
import GemIdentImageSets.ImageSetInterface;
import GemIdentImageSets.NonGlobalImageSet;
import GemIdentImageSets.RegularSubImage;
import GemIdentImageSets.Nuance.NuanceImageListInterface;
import GemIdentOperations.FindErrorRateViaReconcilation;
import GemIdentOperations.Run;
Expand Down
14 changes: 9 additions & 5 deletions GemIdentClassificationEngine/Classify.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,16 @@ private void BeginClassification() {
progress.StartTimer();
Run.it.imageset.LOG_AddToHistory("begun classification of " + filenames.size() + " images");

classifyPool=Executors.newFixedThreadPool(Run.it.num_threads);
/* classifyPool=Executors.newFixedThreadPool(Run.it.num_threads);
for (String filename:filenames)
classifyPool.execute(new SingleImageClassifier(filename));
classifyPool.shutdown();
try {
classifyPool.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS); //effectively infinity
} catch (InterruptedException ignored){}
} catch (InterruptedException ignored){}*/

for (String filename:filenames)
new SingleImageClassifier(filename).run();
progress.RemoveClassifyBars();
}
/**
Expand Down Expand Up @@ -212,8 +215,10 @@ public void run(){
System.out.println("done classifying pixels in image "+filename);
if (!stop){
progress.WritingImages(threadName);
for (String phenotype:Run.it.getPhenotyeNamesSaveNONAndFindPixels())
for (String phenotype:Run.it.getPhenotyeNamesSaveNONAndFindPixels()){
System.out.println("about to write ismatrix for file " + filename + " and phenotype " + phenotype + " and is matrix " + is.get(phenotype).toString());
IOTools.WriteIsMatrix(GetIsName(filename,phenotype),is.get(phenotype));
}

if (!(Run.it.imageset instanceof NuanceImageListInterface)){ //too complicated to do this if its Nuance
MarkIntermediatePixels();
Expand Down Expand Up @@ -296,10 +301,9 @@ private void MarkIntermediatePixels(){
HashMap<String,Boolean> isij=new HashMap<String,Boolean>(Run.it.numPhenotypes());
for (String phenotype:Run.it.getPhenotyeNamesSaveNON())
isij.put(phenotype,is.get(phenotype).get(i,j));
int T=0;

for (String phenotype:Run.it.getPhenotyeNamesSaveNON()){
if (isij.get(phenotype)){
T++;
actualImageInter.MarkPheno(i,j,phenotype);
}
}
Expand Down
2 changes: 1 addition & 1 deletion GemIdentImageSets/ImageAndScoresBank.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public static BufferedImage getOrAddIs(String filename,String dir){
DataImage dataImage=isImages.get(filename);
if (dataImage == null){
dataImage=new RegularSubImage(filename,false);
// isImages.put(filename,dataImage);
isImages.put(filename,dataImage);
}
if (isImages.size() > IS_IMAGES_MAX_SIZE)
isImages.flushToSize(IS_IMAGES_MAX_SIZE);
Expand Down
5 changes: 5 additions & 0 deletions GemIdentImageSets/Nuance/SuperNuanceImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,9 @@ public DataImage getCenterImage(){
public Point AdjustPointForSuper(Point t){
return new Point(t.x+c,t.y+c);
}

@Override
public String filename() {
return filename;
}
}
2 changes: 2 additions & 0 deletions GemIdentImageSets/SuperImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ public interface SuperImage {
*/
public BufferedImage getAsBufferedImage();

public String filename();

}
5 changes: 5 additions & 0 deletions GemIdentImageSets/SuperRegularImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,9 @@ public Point AdjustPointForSuper(Point t){
public SuperRegularImage(String filename, BufferedImage clone, boolean crop) {
super(filename, clone, crop);
}

@Override
public String filename() {
return filename;
}
}
14 changes: 5 additions & 9 deletions GemIdentOperations/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,12 @@ public static void main(String[] args){

/** Prints the source code license to the terminal */
private static void ShowGplMessage() {
System.out.println("GemIdent v1.2b");
System.out.println("GemIdent v1.3b --- http://gemident.com");
System.out.println("Interactive Image Segmentation Software via Supervised Statistical Learning");
System.out.println("http://gemident.com");
System.out.println("");
System.out.println("For GemIdent to be used in tandem with the global labor force of Mechanical Turk, see DistributeEyes");
System.out.println("http://distributeeyes.com");
System.out.println("");
System.out.println("Copyright (C) 2014");
System.out.println("Professor Susan Holmes, Stanford University &");
System.out.println("Adam Kapelner, The Wharton School of the University of Pennsylvania");
System.out.println("Copyright (C) 2016");
System.out.println("Adam Kapelner, Queens College, City University of New York and");
System.out.println("Professor Susan Holmes, Stanford University");
System.out.println("");
System.out.println("GemIdent comes with ABSOLUTELY NO WARRANTY. This is free software, and you are ");
System.out.println("welcome to redistribute it under certain conditions. Please see the GPL v2");
Expand All @@ -110,7 +106,7 @@ private static void ShowGplMessage() {
/** the program title */
private static final String ProgramName = "GemIdent";
/** the string to be used when building the window title (<b>GemIdent</b> is still in beta on the first release) */
private static final String VER = "1.2b";
private static final String VER = "1.3b";
/** The title of the program */
public static final String Title = ProgramName + " v" + VER + " - ";

Expand Down
16 changes: 14 additions & 2 deletions GemIdentTools/Thumbnails.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public static ArrayList<String> GetImageListAsCollection(String dir){
}
/**
* This {@link java.io.FilenameFilter file filter} returns
* only image files of type "jpg", "tif", "tiff, and "bmp"
* only image files of type listed below
* (thanks to TwelveMonkeys ImageIO extensions).
*
*/
public static class ImageFileFilter implements FilenameFilter{
Expand All @@ -124,7 +125,18 @@ public boolean accept(File dir, String name) {
String[] fileparts=name.split("\\.");
if (fileparts.length >= 2){
String ext=fileparts[fileparts.length - 1].toLowerCase();
if (ext.equals("jpg") || ext.equals("tif") || ext.equals("tiff") || ext.equals("TIFF") || ext.equals("bmp") || ext.equals("png"))
if (ext.equals("jpg") ||
ext.equals("jpeg") ||
ext.equals("tif") ||
ext.equals("tiff") ||
ext.equals("bmp") ||
ext.equals("png") ||
ext.equals("ico") ||
ext.equals("pcx") ||
ext.equals("pnm") ||
ext.equals("psd") ||
ext.equals("sgi") ||
ext.equals("tga"))
return true;
else
return false;
Expand Down
2 changes: 0 additions & 2 deletions GemIdentView/AlphaSlider.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ public void stateChanged(ChangeEvent e){
}
/** sets up a mask for an is-pixel image - loads it from the hard disk, creates the 32-bit alpha image, and displays it */
private void SetUpIs(){
// String name=imagePanel.displayImage.getFilename();
// String name2=phenotype.getName();
String isName=Classify.GetIsName(imagePanel.displayImage.getFilename(),phenotype.getName());
if (IOTools.FileExists(isName)){
BufferedImage raw=ImageAndScoresBank.getOrAddIs(isName,null);
Expand Down
1 change: 1 addition & 0 deletions GemIdentView/KFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ public void KillAnalysisTab(){
tabs.remove(analysisPanel);
}
public void SwitchToAnalysisTab(){
System.out.println("SwitchToAnalysisTab analysisPanel:" + analysisPanel);
tabs.setSelectedComponent(analysisPanel);
}
public ConsoleParser getParser(){
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Manifest-Version: 1.0
Main-Class: GemIdentOperations.Run
Class-Path: itext-1.4.8.jar commons-math-2.1.jar
Class-Path: itext-1.4.8.jar commons-math-2.1.jar twelvemonkeys*.jar
19 changes: 8 additions & 11 deletions README → README.Md
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
GemIdent --- Interactive Image Segmentation Software via Supervised Statistical Learning
http://gemident.com

Copyright (C) 2015
Copyright (C) 2016
--
Adam Kapelner, Queens College, CUNY
http://kapelner.com
&
http://kapelner.com &

Professor Susan Holmes, Stanford University
http://statweb.stanford.edu/~susan/

For GemIdent to be used in tandem with the global labor force of Mechanical Turk, see DistributeEyes
http://distributeeyes.com

For GemIdent to be used to track objects in videos see GemVident
https://github.com/kapelner/GemVident
To download the software:
https://github.com/kapelner/GemIdent/blob/master/gemident_executable.zip?raw=true

For the publication see:
http://www.jstatsoft.org/v30/i10

To download the software:
https://github.com/kapelner/GemIdent/blob/master/gemident_executable.zip?raw=true

For the software manual:
https://github.com/kapelner/GemIdent/raw/master/GemManualv2.pdf

Expand All @@ -44,6 +38,9 @@ https://www.youtube.com/watch?v=ZSveLYzhjQU
For a presentation on GemIdent, see:
https://github.com/kapelner/GemIdent/blob/master/gemident_presentation.pdf?raw=true

For GemIdent to be used to track objects in videos see GemVident
https://github.com/kapelner/GemVident

GemIdent is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Expand Down
29 changes: 27 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,35 @@

<!-- This creates the JAR file -->
<target name="distribute_as_jar" depends="compile_java_code" description="generate the jar file" >
<jar destfile="executable/gemident_v1.2.jar" basedir="bin" excludes="executable/**,GemIdentManual/**,examples_image_sets/**,r_scripts/**,*.pdf,*.MF,README,build.xml,.project,.classpath,*.jar">
<jar destfile="executable/gemident_v1.3.jar"
basedir="bin"
excludes="executable/**,GemIdentManual/**,examples_image_sets/**,r_scripts/**,.settings/**,*.pdf,*.MF,README.Md, *.zip, gpl*.txt ,build.xml,.project,.classpath,*.jar">
<manifest>
<attribute name="Main-Class" value="GemIdentOperations.Run"/>
<attribute name="Class-Path" value="lib/itext-1.4.8.jar lib/commons-math-2.1.jar"/>
<attribute name="Class-Path" value="
lib/itext-1.4.8.jar
lib/commons-math-2.1.jar
lib/twelvemonkeys-common-image-3.3-SNAPSHOT.jar
lib/twelvemonkeys-common-io-3.3-SNAPSHOT.jar
lib/twelvemonkeys-common-lang-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-bmp-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-clippath-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-core-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-hdr-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-icns-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-iff-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-jpeg-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-metadata-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-pcx-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-pdf-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-pict-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-pnm-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-psd-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-reference-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-sgi-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-tga-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-thumbsdb-3.3-SNAPSHOT.jar
lib/twelvemonkeys-imageio-tiff-3.3-SNAPSHOT.jar"/>
</manifest>
</jar>
</target>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion executable/run_gemident_mac_unix_linux
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -Xmx1000m -Xss2m -Xoss2m -jar gemident_v1.2.jar
java -Xmx3000m -Xss2m -Xoss2m -jar gemident_v1.3.jar
2 changes: 1 addition & 1 deletion executable/run_gemident_windows.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -Xmx1000m -Xss2m -Xoss2m -jar gemident_v1.2.jar
java -Xmx3000m -Xss2m -Xoss2m -jar gemident_v1.3.jar
Binary file modified gemident_executable.zip
Binary file not shown.
Binary file removed itext-1.4.8.jar
Binary file not shown.

0 comments on commit 8f37e61

Please sign in to comment.