public String[] getRoiList() {
return roiList;
}
private CometeRoi createRoi(final String[] roiDesc) {
CometeRoi roi = null;
if (roiDesc.length == ROI_DESC_LENGTH) {
RoiShape shape = null;
try {
shape = RoiShape.valueOf(roiDesc[1].trim().toUpperCase(Locale.US));
} catch (final IllegalArgumentException e) {
new ErrorDialog(null, "Can not create ROI", "Invalid ROI Shape not added " + Arrays.toString(roiDesc)
+ ".\n\nCorrect values are RECTANGLE, OVAL, POINT, TEXT or CROSS and NONE to supress it.",
false, null).setVisible(true);
}
if (shape != null) {
CometeColor color = null;
try {
final Field colorField = CometeColor.class.getDeclaredField(roiDesc[7].trim().toUpperCase());
color = (CometeColor) colorField.get(colorField);
} catch (final SecurityException e1) {
System.err.println("cant find color => SecurityException");
} catch (final NoSuchFieldException e1) {
System.err.println("color does'nt exist");
} catch (final IllegalArgumentException e) {
System.err.println("cant find color => IllegalArgumentException");
} catch (final IllegalAccessException e) {
System.err.println("cant find color => IllegalAccessException");
}
if (color != null) {
try {
roi = new CometeRoi(roiDesc[0].trim(), shape, Integer.parseInt(roiDesc[2].trim()),
Integer.parseInt(roiDesc[3].trim()), Integer.parseInt(roiDesc[4].trim()),
Integer.parseInt(roiDesc[5].trim()), Integer.parseInt(roiDesc[6].trim()), color);
} catch (final NumberFormatException e) {
// TODO change to logger
System.err.println("invalid size or position: " + e.getMessage());