use of uk.ac.mrc.hgu.Wlz.WlzException in project bioformats by openmicroscopy.
the class WlzServiceImpl method setupWrite.
@Override
public void setupWrite(int orgX, int orgY, int orgZ, int pixSzX, int pixSzY, int pixSzZ, int pixSzC, int pixSzT, double voxSzX, double voxSzY, double voxSzZ, int gType) throws FormatException {
bBox = new WlzIBox3();
bBox.xMin = orgX;
bBox.yMin = orgY;
bBox.zMin = orgZ;
bBox.xMax = orgX + pixSzX - 1;
bBox.yMax = orgY + pixSzY - 1;
bBox.zMax = orgZ + pixSzZ - 1;
voxSz = new WlzDVertex3(voxSzX, voxSzY, voxSzZ);
if ((bBox.xMax < bBox.xMin) || (bBox.yMax < bBox.yMin) || (bBox.zMax < bBox.zMin) || (pixSzC <= 0) || (pixSzT <= 0)) {
throw new FormatException("Invalid image size (" + (bBox.xMax - bBox.xMin + 1) + ", " + (bBox.yMax - bBox.yMin + 1) + ", " + (bBox.zMax - bBox.zMin + 1) + ", " + pixSzC + ", " + pixSzT + ")");
}
switch(gType) {
case FormatTools.UINT8:
objGType = WlzGreyType.WLZ_GREY_UBYTE;
break;
case FormatTools.INT16:
objGType = WlzGreyType.WLZ_GREY_SHORT;
break;
case FormatTools.INT32:
objGType = WlzGreyType.WLZ_GREY_INT;
break;
case FormatTools.FLOAT:
objGType = WlzGreyType.WLZ_GREY_FLOAT;
break;
case FormatTools.DOUBLE:
objGType = WlzGreyType.WLZ_GREY_DOUBLE;
break;
default:
throw new FormatException("Invalid image value type");
}
if (bBox.zMax == bBox.zMin) {
objType = WlzObjectType.WLZ_2D_DOMAINOBJ;
} else {
objType = WlzObjectType.WLZ_3D_DOMAINOBJ;
}
try {
wlzObj = WlzObject.WlzMakeEmpty();
} catch (WlzException e) {
throw new FormatException("Failed to create Woolz object", e);
}
}
Aggregations