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

Method getSliceLabels

ij/src/main/java/ij/io/TiffDecoder.java:705–729  ·  view source on GitHub ↗
(int first, int last, FileInfo fi)

Source from the content-addressed store, hash-verified

703 }
704
705 void getSliceLabels(int first, int last, FileInfo fi) throws IOException {
706 fi.sliceLabels = new String[last-first+1];
707 int index = 0;
708 byte[] buffer = new byte[metaDataCounts[first]];
709 for (int i=first; i<=last; i++) {
710 int len = metaDataCounts[i];
711 if (len>0) {
712 if (len>buffer.length)
713 buffer = new byte[len];
714 in.readFully(buffer, len);
715 len /= 2;
716 char[] chars = new char[len];
717 if (littleEndian) {
718 for (int j=0, k=0; j<len; j++)
719 chars[j] = (char)(buffer[k++]&255 + ((buffer[k++]&255)<<8));
720 } else {
721 for (int j=0, k=0; j<len; j++)
722 chars[j] = (char)(((buffer[k++]&255)<<8) + (buffer[k++]&255));
723 }
724 fi.sliceLabels[index++] = new String(chars);
725 //ij.IJ.log(i+" "+fi.sliceLabels[i-1]+" "+len);
726 } else
727 fi.sliceLabels[index++] = null;
728 }
729 }
730
731 void getDisplayRanges(int first, FileInfo fi) throws IOException {
732 int n = metaDataCounts[first]/8;

Callers 4

getMetaDataMethod · 0.95
saveAsTiffStackMethod · 0.45
serializeMethod · 0.45
saveAsZipMethod · 0.45

Calls 1

readFullyMethod · 0.65

Tested by

no test coverage detected