MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getColorMap

Method getColorMap

ij/src/main/java/ij/io/TiffDecoder.java:159–183  ·  view source on GitHub ↗
(long offset, FileInfo fi)

Source from the content-addressed store, hash-verified

157 }
158
159 void getColorMap(long offset, FileInfo fi) throws IOException {
160 byte[] colorTable16 = new byte[768*2];
161 long saveLoc = in.getLongFilePointer();
162 in.seek(offset);
163 in.readFully(colorTable16);
164 in.seek(saveLoc);
165 fi.lutSize = 256;
166 fi.reds = new byte[256];
167 fi.greens = new byte[256];
168 fi.blues = new byte[256];
169 int j = 0;
170 if (littleEndian) j++;
171 int sum = 0;
172 for (int i=0; i<256; i++) {
173 fi.reds[i] = colorTable16[j];
174 sum += fi.reds[i];
175 fi.greens[i] = colorTable16[512+j];
176 sum += fi.greens[i];
177 fi.blues[i] = colorTable16[1024+j];
178 sum += fi.blues[i];
179 j += 2;
180 }
181 if (sum!=0 && fi.fileType==FileInfo.GRAY8)
182 fi.fileType = FileInfo.COLOR8;
183 }
184
185 byte[] getString(int count, long offset) throws IOException {
186 count--; // skip null byte at end of string

Callers 1

OpenIFDMethod · 0.95

Calls 3

getLongFilePointerMethod · 0.80
seekMethod · 0.65
readFullyMethod · 0.65

Tested by

no test coverage detected