(ImageStack stack, String tag)
| 36 | } |
| 37 | |
| 38 | private static String[] getSortStrings(ImageStack stack, String tag) { |
| 39 | double series = getSeriesNumber(getSliceLabel(stack,1)); |
| 40 | int n = stack.size(); |
| 41 | boolean checkRescaleSlope = (stack instanceof VirtualStack)?((VirtualStack)stack).getBitDepth()==16:false; |
| 42 | if (Prefs.ignoreRescaleSlope) |
| 43 | checkRescaleSlope = false; |
| 44 | boolean showError = false; |
| 45 | String[] values = new String[n]; |
| 46 | sliceLabels = new String[n]; |
| 47 | for (int i=1; i<=n; i++) { |
| 48 | String tags = getSliceLabel(stack,i); |
| 49 | if (tags==null) return null; |
| 50 | sliceLabels[i-1] = tags; |
| 51 | double value = getNumericTag(tags, tag); |
| 52 | if (Double.isNaN(value)) { |
| 53 | if (IJ.debugMode) IJ.log(" "+tag+" tag missing in slice "+i); |
| 54 | if (showError) rescaleSlopeError(stack); |
| 55 | return null; |
| 56 | } |
| 57 | if (getSeriesNumber(tags)!=series) { |
| 58 | if (IJ.debugMode) IJ.log(" all slices must be part of the same series"); |
| 59 | if (showError) rescaleSlopeError(stack); |
| 60 | return null; |
| 61 | } |
| 62 | values[i-1] = toString(value, MAX_DIGITS) + toString(i, MAX_DIGITS); |
| 63 | if (checkRescaleSlope) { |
| 64 | double rescaleSlope = getNumericTag(tags, "0028,1053"); |
| 65 | if (rescaleSlope!=1.0) |
| 66 | showError = true; |
| 67 | } |
| 68 | } |
| 69 | if (showError) rescaleSlopeError(stack); |
| 70 | return values; |
| 71 | } |
| 72 | |
| 73 | private static void rescaleSlopeError(ImageStack stack) { |
| 74 | ((VirtualStack)stack).setBitDepth(32); |
no test coverage detected