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

Method getMetaData

ij/src/main/java/ij/io/TiffDecoder.java:603–687  ·  view source on GitHub ↗
(int loc, FileInfo fi)

Source from the content-addressed store, hash-verified

601 }
602
603 void getMetaData(int loc, FileInfo fi) throws IOException {
604 if (metaDataCounts==null || metaDataCounts.length==0)
605 return;
606 int maxTypes = 10;
607 long saveLoc = in.getLongFilePointer();
608 in.seek(loc);
609 int n = metaDataCounts.length;
610 int hdrSize = metaDataCounts[0];
611 if (hdrSize<12 || hdrSize>804) {
612 in.seek(saveLoc);
613 return;
614 }
615 int magicNumber = getInt();
616 if (magicNumber!=MAGIC_NUMBER) { // "IJIJ"
617 in.seek(saveLoc);
618 return;
619 }
620 int nTypes = (hdrSize-4)/8;
621 int[] types = new int[nTypes];
622 int[] counts = new int[nTypes];
623 if (debugMode) {
624 dInfo += "Metadata:\n";
625 dInfo += " Entries: "+(metaDataCounts.length-1)+"\n";
626 dInfo += " Types: "+nTypes+"\n";
627 }
628 int extraMetaDataEntries = 0;
629 int index = 1;
630 for (int i=0; i<nTypes; i++) {
631 types[i] = getInt();
632 counts[i] = getInt();
633 if (types[i]<0xffffff)
634 extraMetaDataEntries += counts[i];
635 if (debugMode) {
636 String id = "unknown";
637 if (types[i]==INFO) id = "Info property";
638 if (types[i]==LABELS) id = "slice labels";
639 if (types[i]==RANGES) id = "display ranges";
640 if (types[i]==LUTS) id = "luts";
641 if (types[i]==PLOT) id = "plot";
642 if (types[i]==ROI) id = "roi";
643 if (types[i]==OVERLAY) id = "overlay";
644 if (types[i]==PROPERTIES) id = "properties";
645 int len = metaDataCounts[index];
646 int count = counts[i];
647 index += count;
648 if (index>=metaDataCounts.length) index=1;
649 String lenstr = count==1?", length=":", length[0]=";
650 dInfo += " "+i+", type="+id+", count="+count+lenstr+len+"\n";
651 }
652 }
653 fi.metaDataTypes = new int[extraMetaDataEntries];
654 fi.metaData = new byte[extraMetaDataEntries][];
655 int start = 1;
656 int eMDindex = 0;
657 for (int i=0; i<nTypes; i++) {
658 if (types[i]==INFO)
659 getInfoProperty(start, fi);
660 else if (types[i]==LABELS)

Callers 1

OpenIFDMethod · 0.95

Calls 13

getIntMethod · 0.95
getInfoPropertyMethod · 0.95
getSliceLabelsMethod · 0.95
getDisplayRangesMethod · 0.95
getLutsMethod · 0.95
getPlotMethod · 0.95
getRoiMethod · 0.95
getOverlayMethod · 0.95
getPropertiesMethod · 0.95
skipUnknownTypeMethod · 0.95
getLongFilePointerMethod · 0.80
seekMethod · 0.65

Tested by

no test coverage detected