if (attachmentInformation == null)
throw new NullPointerException("Null attachmentInformation");
Matrix<? extends PIntegerArray> packed = asNeighbourhoodBitMaps(skeleton);
switch (attachmentInformation) {
case NEIGHBOUR_INDEX_OF_ATTACHING_BRANCH:
return Matrices.asFuncMatrix(false, new AbstractFunc() {
@Override
public double get(double... x) {
return get(x[0]);
}
@Override
public double get(double x0) {
int apertureBits = (int) x0; // precise operations, because x0 is "int" 31-bit value
if ((apertureBits & 1) == 0) {
return TYPE_ZERO;
}
return pixelTypeOrAttachingBranch(apertureBits >>> 1);
}
}, IntArray.class, packed);
case NEIGHBOUR_INDEX_OF_ATTACHED_NODE:
return Matrices.asFuncMatrix(false, new AbstractFunc() {
@Override
public double get(double... x) {
return get(x[0]);
}