From 6e67b0aabf94e5fbaa3754ea5e3f4190f34c81f7 Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Thu, 24 Mar 2011 12:02:41 +0000
Subject: [PATCH] add: interfaces for image reading

SVN: 20485
---
 .../cisd/imagereaders/IImageReader.java       | 40 +++++++++++++++++++
 .../imagereaders/IImageReaderLibrary.java     | 36 +++++++++++++++++
 .../cisd/imagereaders/ImageReaderFactory.java | 31 ++++++++++++++
 3 files changed, 107 insertions(+)
 create mode 100644 image_readers/source/java/ch/systemsx/cisd/imagereaders/IImageReader.java
 create mode 100644 image_readers/source/java/ch/systemsx/cisd/imagereaders/IImageReaderLibrary.java
 create mode 100644 image_readers/source/java/ch/systemsx/cisd/imagereaders/ImageReaderFactory.java

diff --git a/image_readers/source/java/ch/systemsx/cisd/imagereaders/IImageReader.java b/image_readers/source/java/ch/systemsx/cisd/imagereaders/IImageReader.java
new file mode 100644
index 00000000000..5bfcaeb0f49
--- /dev/null
+++ b/image_readers/source/java/ch/systemsx/cisd/imagereaders/IImageReader.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2011 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.imagereaders;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+
+import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked;
+import ch.systemsx.cisd.base.io.IRandomAccessFile;
+
+/**
+ * @author Bernd Rinn
+ */
+public interface IImageReader
+{
+    public String getLibraryName();
+
+    public String getName();
+
+    public BufferedImage readImage(File file, int page) throws IOExceptionUnchecked;
+
+    public BufferedImage readImage(String filename, IRandomAccessFile handle, int page)
+            throws IOExceptionUnchecked;
+
+    public BufferedImage readImage(String filename, byte[] bytes, int page);
+}
diff --git a/image_readers/source/java/ch/systemsx/cisd/imagereaders/IImageReaderLibrary.java b/image_readers/source/java/ch/systemsx/cisd/imagereaders/IImageReaderLibrary.java
new file mode 100644
index 00000000000..6eb42df6c46
--- /dev/null
+++ b/image_readers/source/java/ch/systemsx/cisd/imagereaders/IImageReaderLibrary.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.imagereaders;
+
+import java.util.List;
+
+/**
+ * 
+ *
+ * @author Bernd Rinn
+ */
+public interface IImageReaderLibrary
+{
+    public String getName();
+    
+    public List<String> getReaderNames();
+    
+    public IImageReader tryGetReader(String readerName);
+    
+    public IImageReader tryGetReaderForFile(String fileName);
+    
+}
diff --git a/image_readers/source/java/ch/systemsx/cisd/imagereaders/ImageReaderFactory.java b/image_readers/source/java/ch/systemsx/cisd/imagereaders/ImageReaderFactory.java
new file mode 100644
index 00000000000..0043a792cb4
--- /dev/null
+++ b/image_readers/source/java/ch/systemsx/cisd/imagereaders/ImageReaderFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.imagereaders;
+
+import java.util.ServiceLoader;
+
+/**
+ * A factory for image readers.
+ * <p>
+ * Uses {@link ServiceLoader}s underneath to find out about the available libraries and readers.
+ *
+ * @author Bernd Rinn
+ */
+public class ImageReaderFactory
+{
+
+}
-- 
GitLab