-
Notifications
You must be signed in to change notification settings - Fork 238
/
IFormatReader.java
194 lines (157 loc) · 6.42 KB
/
IFormatReader.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
//
// IFormatReader.java
//
/*
LOCI Bio-Formats package for reading and converting biological file formats.
Copyright (C) 2005-@year@ Melissa Linkert, Curtis Rueden, Chris Allan
and Eric Kjellman.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package loci.formats;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Hashtable;
/** Abstract superclass of all biological file format readers. */
public interface IFormatReader extends IFormatHandler {
/** Checks if the given block is a valid header for this file format. */
boolean isThisType(byte[] block);
/** Determines the number of images in the given file. */
int getImageCount(String id)
throws FormatException, IOException;
/** Checks if the images in the file are RGB. */
boolean isRGB(String id)
throws FormatException, IOException;
/** Get the size of the X dimension. */
int getSizeX(String id) throws FormatException, IOException;
/** Get the size of the Y dimension. */
int getSizeY(String id) throws FormatException, IOException;
/** Get the size of the Z dimension. */
int getSizeZ(String id) throws FormatException, IOException;
/** Get the size of the C dimension. */
int getSizeC(String id) throws FormatException, IOException;
/** Get the size of the T dimension. */
int getSizeT(String id) throws FormatException, IOException;
/** Get the size of the X dimension for the thumbnail. */
int getThumbSizeX(String id) throws FormatException, IOException;
/** Get the size of the Y dimension for the thumbnail. */
int getThumbSizeY(String id) throws FormatException, IOException;
/** Return true if the data is in little-endian format. */
boolean isLittleEndian(String id)
throws FormatException, IOException;
/**
* Return a five-character string representing the dimension order
* within the file.
*/
String getDimensionOrder(String id)
throws FormatException, IOException;
/** Obtains the specified image from the given file. */
BufferedImage openImage(String id, int no)
throws FormatException, IOException;
/**
* Obtains the specified image from the given file as a byte array.
*/
byte[] openBytes(String id, int no)
throws FormatException, IOException;
/** Obtains a thumbnail for the specified image from the given file. */
BufferedImage openThumbImage(String id, int no)
throws FormatException, IOException;
/**
* Obtains a thumbnail for the specified image from the given file,
* as a byte array.
*/
byte[] openThumbBytes(String id, int no)
throws FormatException, IOException;
/** Closes the currently open file. */
void close() throws FormatException, IOException;
/**
* Opens an existing file from the given filename.
*
* @return Java Images containing pixel data
*/
BufferedImage[] openImage(String id)
throws FormatException, IOException;
/** Return the number of series in this file. */
int getSeriesCount(String id) throws FormatException, IOException;
/** Activates the specified series. */
void setSeries(String id, int no) throws FormatException, IOException;
/** Returns the currently active series. */
int getSeries(String id) throws FormatException, IOException;
/**
* Allows the client to specify whether or not to separate channels.
* By default, channels are left unseparated; thus if we encounter an RGB
* image plane, it will be left as RGB and not split into 3 separate planes.
*/
void setSeparated(boolean separate);
/** Gets whether channels are being separated. */
boolean isSeparated();
/**
* Gets the rasterized index corresponding
* to the given Z, C and T coordinates.
*/
int getIndex(String id, int z, int c, int t)
throws FormatException, IOException;
/**
* Gets the Z, C and T coordinates corresponding
* to the given rasterized index value.
*/
int[] getZCTCoords(String id, int index)
throws FormatException, IOException;
/**
* Obtains the specified metadata field's value for the given file.
*
* @param field the name associated with the metadata field
* @return the value, or null if the field doesn't exist
*/
Object getMetadataValue(String id, String field)
throws FormatException, IOException;
/**
* Obtains the hashtable containing the metadata field/value pairs from
* the given file.
*
* @param id the filename
* @return the hashtable containing all metadata from the file
*/
Hashtable getMetadata(String id) throws FormatException, IOException;
/**
* Sets the default metadata store for this reader.
*
* @param store a metadata store implementation.
*/
void setMetadataStore(MetadataStore store);
/**
* Retrieves the current metadata store for this reader. You can be
* assured that this method will <b>never</b> return a <code>null</code>
* metadata store.
* @return a metadata store implementation.
*/
MetadataStore getMetadataStore(String id)
throws FormatException, IOException;
/**
* Retrieves the current metadata store's root object. It is guaranteed that
* all file parsing has been performed by the reader prior to retrieval.
* Requests for a full populated root object should be made using this method.
* @param id a fully qualified path to the file.
* @return current metadata store's root object fully populated.
* @throws IOException if there is an IO error when reading the file specified
* by <code>path</code>.
* @throws FormatException if the file specified by <code>path</code> is of an
* unsupported type.
*/
Object getMetadataStoreRoot(String id)
throws FormatException, IOException;
/**
* A utility method for test reading a file from the command line,
* and displaying the results in a simple display.
*/
boolean testRead(String[] args) throws FormatException, IOException;
}