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

Method sort

ij/src/main/java/ij/util/DicomTools.java:12–24  ·  view source on GitHub ↗

Sorts a DICOM stack by image number.

(ImageStack stack)

Source from the content-addressed store, hash-verified

10
11 /** Sorts a DICOM stack by image number. */
12 public static ImageStack sort(ImageStack stack) {
13 if (IJ.debugMode) IJ.log("Sorting by DICOM image number");
14 if (stack.size()==1) return stack;
15 String[] strings = getSortStrings(stack, "0020,0013");
16 if (strings==null) return stack;
17 StringSorter.sort(strings);
18 ImageStack stack2 = null;
19 if (stack.isVirtual())
20 stack2 = ((VirtualStack)stack).sortDicom(strings, sliceLabels, MAX_DIGITS);
21 else
22 stack2 = sortStack(stack, strings);
23 return stack2!=null?stack2:stack;
24 }
25
26 private static ImageStack sortStack(ImageStack stack, String[] strings) {
27 ImageProcessor ip = stack.getProcessor(1);

Callers 1

runMethod · 0.95

Calls 7

logMethod · 0.95
getSortStringsMethod · 0.95
sortMethod · 0.95
sortStackMethod · 0.95
sortDicomMethod · 0.80
sizeMethod · 0.45
isVirtualMethod · 0.45

Tested by

no test coverage detected