private void readIndexMap() throws IOException { MappedByteBuffer mapOffset = makeReadOnlyBuffer(8, 8); if (mapOffset.getInt() != MultipageTiffWriter.INDEX_MAP_OFFSET_HEADER) { ReportingUtils.logError("Image map offset header incorrect"); indexMap_ = null; return; } long offset = unsignInt(mapOffset.getInt()); MappedByteBuffer mapHeader = makeReadOnlyBuffer(offset, 8); int headerCode = mapHeader.getInt(); if (headerCode != MultipageTiffWriter.INDEX_MAP_HEADER) { ReportingUtils.logError("Image index map header incorrect"); indexMap_ = null; return; } int numMappings = mapHeader.getInt(); MappedByteBuffer mapData = makeReadOnlyBuffer(offset + 8, 24 * numMappings); for (int i = 0; i < numMappings; i++) { int channel = mapData.getInt(); int slice = mapData.getInt(); int frame = mapData.getInt(); int position = mapData.getInt(); long imageOffset = mapData.getLong(); indexMap_.put(MDUtils.generateLabel(channel, slice, frame, position), imageOffset); } }