// "ListDicomTags.txt" // This macro lists selected tags of a DICOM stack opened // with File>Import>Image Sequence. Edit the first two lines // of the macro to specify which tags get listed. // Note that the tags must be numeric. macro "List Stack Tags" { tags = newArray("0018,0050","0018,0088"); names = newArray("Slice Thickness","Slice Spacing"); requires("1.33q"); run("Clear Results"); for (slice=1; slice<=nSlices; slice++) { setSlice(slice); for (i=0; i0) value = substring(value, 0, index3); value = 0 + value; // convert to number return value; } // This function returns the value of the specified // tag (e.g., "0010,0010") as a string. Returns "" // if the tag is not found. function getTag(tag) { info = getImageInfo(); index1 = indexOf(info, tag); if (index1==-1) return ""; index1 = indexOf(info, ":", index1); if (index1==-1) return ""; index2 = indexOf(info, "\n", index1); value = substring(info, index1+1, index2); return value; }