Permalink
Browse files

Rename to OpenSlide

  • Loading branch information...
1 parent 7e8d012 commit 9851c2b81b1e502dc00c04f155a5ef6516be9c20 @agoode agoode committed Dec 9, 2008
View
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src">
<attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="Wholeslide"/>
+ <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="OpenSlide"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
View
@@ -1,7 +1,7 @@
/bin
-/wholeslide_wrap.c
-/wholeslidejava.jar
+/openslide_wrap.c
+/openslidejava.jar
-/src/edu/cmu/cs/wholeslide/glue
+/src/edu/cmu/cs/openslide/glue
*.so
View
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>Wholeslide</name>
+ <name>OpenSlide</name>
<comment></comment>
<projects>
</projects>
View
@@ -1,8 +1,8 @@
-Wholeslide
+OpenSlide
Carnegie Mellon University
-http://wholeslide.cs.cmu.edu/
+http://openslide.cs.cmu.edu/
====================
View
@@ -3,20 +3,20 @@
CC = gcc
JAVAC = javac
-all: libwholeslidejava.so src/edu/cmu/cs/wholeslide/glue/Wholeslide.java
+all: libopenslidejava.so src/edu/cmu/cs/openslide/glue/OpenSlide.java
ant
-wholeslide_wrap.c src/edu/cmu/cs/wholeslide/glue/Wholeslide.java: wholeslide.i
- mkdir -p src/edu/cmu/cs/wholeslide/glue
- swig -includeall -Wall -I/usr/include -java $$(pkg-config wholeslide --cflags-only-I) -package edu.cmu.cs.wholeslide.glue -outdir src/edu/cmu/cs/wholeslide/glue $<
+openslide_wrap.c src/edu/cmu/cs/openslide/glue/OpenSlide.java: openslide.i
+ mkdir -p src/edu/cmu/cs/openslide/glue
+ swig -includeall -Wall -I/usr/include -java $$(pkg-config openslide --cflags-only-I) -package edu.cmu.cs.openslide.glue -outdir src/edu/cmu/cs/openslide/glue $<
-libwholeslidejava.so: wholeslide_wrap.c
- $(CC) $(CFLAGS) -fPIC -fno-strict-aliasing -shared -g -O2 -Wall -o $@ $< $$(pkg-config wholeslide --cflags --libs)
+libopenslidejava.so: openslide_wrap.c
+ $(CC) $(CFLAGS) -fPIC -fno-strict-aliasing -shared -g -O2 -Wall -o $@ $< $$(pkg-config openslide --cflags --libs)
clean:
ant clean
- $(RM) libwholeslidejava.so wholeslide_wrap.c src/edu/cmu/cs/wholeslide/glue/*.java *~ bin
+ $(RM) libopenslidejava.so openslide_wrap.c src/edu/cmu/cs/openslide/glue/*.java *~ bin
View
@@ -1,6 +1,6 @@
-Fancy zooming/scrolling in WholeslideView
+Fancy zooming/scrolling in OpenSlideView
-Rotation in WholeslideView
+Rotation in OpenSlideView
Make swig generated Java code not public
View
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project basedir="." default="jar" name="wholeslide java">
+<project basedir="." default="jar" name="openslide java">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.5"/>
<property name="source" value="1.5"/>
- <path id="wholeslide java.classpath">
+ <path id="openslide java.classpath">
<pathelement location="bin"/>
</path>
<target name="init">
@@ -15,19 +15,19 @@
</target>
<target name="clean">
<delete dir="bin"/>
- <delete file="wholeslidejava.jar" />
+ <delete file="openslidejava.jar" />
</target>
<target depends="clean" name="cleanall"/>
<target depends="build" name="jar">
- <jar destfile="wholeslidejava.jar" basedir="bin"/>
+ <jar destfile="openslidejava.jar" basedir="bin"/>
</target>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
<src path="src"/>
- <classpath refid="wholeslide java.classpath"/>
+ <classpath refid="openslide java.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
View
@@ -0,0 +1,79 @@
+/* -*- c -*- */
+/*
+ * OpenSlide, a library for reading whole slide image files
+ *
+ * Copyright (c) 2007-2008 Carnegie Mellon University
+ * All rights reserved.
+ *
+ * OpenSlide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * OpenSlide 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
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with OpenSlide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Linking OpenSlide statically or dynamically with other modules is
+ * making a combined work based on OpenSlide. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ */
+
+%module OpenSlide
+
+%include "typemaps.i"
+%include "arrays_java.i"
+%include "various.i"
+
+#include <stdint.h>
+
+%javaconst(1);
+
+%{
+#include "openslide.h"
+%}
+
+%pragma(java) jniclasscode=%{
+ static {
+ try {
+ System.loadLibrary("openslidejava");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. \n" + e);
+ }
+ }
+%}
+
+%newobject openslide_open;
+
+%apply long long[] {int64_t *};
+%apply int[] {uint32_t *};
+
+typedef struct _openslide openslide_t;
+
+bool openslide_can_open(const char *filename);
+
+openslide_t *openslide_open(const char *filename);
+
+void openslide_get_layer_dimensions(openslide_t *osr, int32_t layer,
+ int64_t *OUTPUT, int64_t *OUTPUT);
+
+int32_t openslide_get_layer_count(openslide_t *osr);
+
+void openslide_close(openslide_t *osr);
+
+const char *openslide_get_comment(openslide_t *osr);
+
+int32_t openslide_get_best_layer_for_downsample(openslide_t *osr,
+ double downsample);
+
+double openslide_get_layer_downsample(openslide_t *osr, int32_t layer);
+
+void openslide_read_region(openslide_t *osr,
+ uint32_t *dest,
+ int64_t x, int64_t y,
+ int32_t layer,
+ int64_t w, int64_t h);
@@ -1,39 +1,39 @@
/*
- * Wholeslide, a library for reading whole slide image files
+ * OpenSlide, a library for reading whole slide image files
*
* Copyright (c) 2007-2008 Carnegie Mellon University
* All rights reserved.
*
- * Wholeslide is free software: you can redistribute it and/or modify
+ * OpenSlide is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.
*
- * Wholeslide is distributed in the hope that it will be useful,
+ * OpenSlide 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Wholeslide. If not, see <http://www.gnu.org/licenses/>.
+ * along with OpenSlide. If not, see <http://www.gnu.org/licenses/>.
*
- * Linking Wholeslide statically or dynamically with other modules is
- * making a combined work based on Wholeslide. Thus, the terms and
+ * Linking OpenSlide statically or dynamically with other modules is
+ * making a combined work based on OpenSlide. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*/
-package edu.cmu.cs.wholeslide;
+package edu.cmu.cs.openslide;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.io.File;
-import edu.cmu.cs.wholeslide.glue.SWIGTYPE_p__wholeslide;
+import edu.cmu.cs.openslide.glue.SWIGTYPE_p__openslide;
-public class Wholeslide {
- private SWIGTYPE_p__wholeslide wsd;
+public class OpenSlide {
+ private SWIGTYPE_p__openslide osr;
final private long layerWidths[];
@@ -42,21 +42,22 @@
final private int layerCount;
public static boolean fileIsValid(File file) {
- return edu.cmu.cs.wholeslide.glue.Wholeslide
- .ws_can_open(file.getPath());
+ return edu.cmu.cs.openslide.glue.OpenSlide.openslide_can_open(file
+ .getPath());
}
- public Wholeslide(File file) {
- wsd = edu.cmu.cs.wholeslide.glue.Wholeslide.ws_open(file.getPath());
+ public OpenSlide(File file) {
+ osr = edu.cmu.cs.openslide.glue.OpenSlide
+ .openslide_open(file.getPath());
- if (wsd == null) {
+ if (osr == null) {
// TODO not just file not found
- throw new WholeslideException();
+ throw new OpenSlideException();
}
// store layer count
- layerCount = edu.cmu.cs.wholeslide.glue.Wholeslide
- .ws_get_layer_count(wsd);
+ layerCount = edu.cmu.cs.openslide.glue.OpenSlide
+ .openslide_get_layer_count(osr);
// store dimensions
layerWidths = new long[layerCount];
@@ -65,17 +66,17 @@ public Wholeslide(File file) {
for (int i = 0; i < layerCount; i++) {
long w[] = new long[1];
long h[] = new long[1];
- edu.cmu.cs.wholeslide.glue.Wholeslide.ws_get_layer_dimensions(wsd,
- i, w, h);
+ edu.cmu.cs.openslide.glue.OpenSlide.openslide_get_layer_dimensions(
+ osr, i, w, h);
layerWidths[i] = w[0];
layerHeights[i] = h[0];
}
}
public void dispose() {
- if (wsd != null) {
- edu.cmu.cs.wholeslide.glue.Wholeslide.ws_close(wsd);
- wsd = null;
+ if (osr != null) {
+ edu.cmu.cs.openslide.glue.OpenSlide.openslide_close(osr);
+ osr = null;
}
}
@@ -90,8 +91,8 @@ public int getLayerCount() {
}
private void checkDisposed() {
- if (wsd == null) {
- throw new WholeslideDisposedException();
+ if (osr == null) {
+ throw new OpenSlideDisposedException();
}
}
@@ -114,7 +115,7 @@ public long getLayerHeight(int layer) {
public String getComment() {
checkDisposed();
- return edu.cmu.cs.wholeslide.glue.Wholeslide.ws_get_comment(wsd);
+ return edu.cmu.cs.openslide.glue.OpenSlide.openslide_get_comment(osr);
}
public void paintRegion(Graphics2D g, int dx, int dy, int sx, int sy,
@@ -127,12 +128,12 @@ public void paintRegion(Graphics2D g, int dx, int dy, int sx, int sy,
}
// get the layer
- int layer = edu.cmu.cs.wholeslide.glue.Wholeslide
- .ws_get_best_layer_for_downsample(wsd, downsample);
+ int layer = edu.cmu.cs.openslide.glue.OpenSlide
+ .openslide_get_best_layer_for_downsample(osr, downsample);
// figure out its downsample
- double layerDS = edu.cmu.cs.wholeslide.glue.Wholeslide
- .ws_get_layer_downsample(wsd, layer);
+ double layerDS = edu.cmu.cs.openslide.glue.OpenSlide
+ .openslide_get_layer_downsample(osr, layer);
// compute the difference
double relativeDS = downsample / layerDS;
@@ -181,8 +182,8 @@ public void paintRegion(Graphics2D g, int dx, int dy, int sx, int sy,
int data[] = ((DataBufferInt) img.getRaster().getDataBuffer())
.getData();
- edu.cmu.cs.wholeslide.glue.Wholeslide.ws_read_region(wsd, data, baseX,
- baseY, layer, img.getWidth(), img.getHeight());
+ edu.cmu.cs.openslide.glue.OpenSlide.openslide_read_region(osr, data,
+ baseX, baseY, layer, img.getWidth(), img.getHeight());
// g.scale(1.0 / relativeDS, 1.0 / relativeDS);
g.drawImage(img, dx, dy, w, h, null);
@@ -0,0 +1,31 @@
+/*
+ * OpenSlide, a library for reading whole slide image files
+ *
+ * Copyright (c) 2007-2008 Carnegie Mellon University
+ * All rights reserved.
+ *
+ * OpenSlide is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * OpenSlide 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
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with OpenSlide. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Linking OpenSlide statically or dynamically with other modules is
+ * making a combined work based on OpenSlide. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ */
+
+package edu.cmu.cs.openslide;
+
+public class OpenSlideDisposedException extends OpenSlideException {
+ public OpenSlideDisposedException() {
+ super("OpenSlide object has been disposed");
+ }
+}
Oops, something went wrong.

0 comments on commit 9851c2b

Please sign in to comment.