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

Method swapSlices

ij/src/main/java/ij/VirtualStack.java:132–154  ·  view source on GitHub ↗
(int o, int n)

Source from the content-addressed store, hash-verified

130 }
131
132 @AstroImageJ(reason = "Add method for moving sliced in a stack")
133 public void swapSlices(int o, int n) {
134 if (isTranslatingIndices()) {
135 throw new IllegalArgumentException("Virtual hyperstack with non-czt order cannot be modified");
136 }
137 if (o<1 || o>nSlices || n<1 || n>nSlices)
138 throw new IllegalArgumentException("Argument out of range: "+o+" "+n);
139 if (o==n) return;
140
141 var no = names[o-1];
142 var lo = labels[o-1];
143
144 names[o-1] = names[n-1];
145 labels[o-1] = labels[n-1];
146 names[n-1] = no;
147 labels[n-1] = lo;
148
149 if (indexes != null) {
150 var io = indexes[o-1];
151 indexes[o-1] = indexes[n-1];
152 indexes[n-1] = io;
153 }
154 }
155
156 /**
157 * Sorts the stack based on provided indexes array.

Callers 5

firstMethod · 0.80
bkwdMethod · 0.80
fwdMethod · 0.80
lastMethod · 0.80
dupMethod · 0.80

Calls 1

isTranslatingIndicesMethod · 0.95

Tested by

no test coverage detected