private void init() {
add(new CombinedPainter());
add(new OriginalPainter());
- add(new MarkupPainter());
- add(new MaskPainter());
- add(new ForegroundOnlyPainter());
- add(new OutlineOverlayPainter());
+ /*
+ * Commented different views of segmentation. Currently original and combined painter are enabled
+ */
+ //add(new MarkupPainter());
+ //add(new MaskPainter());
+ //add(new ForegroundOnlyPainter());
+ //add(new OutlineOverlayPainter());
}
public static void disableAllSegments()
{
- for(SegmentationMask currentSegmentMask : segmentationMaskObjects)
+ if (!(segmentationMaskObjects.isEmpty()))
{
- currentSegmentMask.enabled = false;
- }
+ for(SegmentationMask currentSegmentMask : segmentationMaskObjects)
+ {
+ currentSegmentMask.enabled = false;
+ }
+ }
}
/**
String speciesTermName = "", collectionId = "", comment = "", curatorName = "",speciesTermId = "";
int width = 0,height = 0;
int noOfSegments = 0;
+ int noOfChildern = 0;
String [][] tempStorage = null;
SegmentationContext ctx = null;
while ((entry = in.getNextEntry()) != null) {
String name = entry.getName();
- if (name.equals("image.png")) {
+ if (name.equals("image")) {
imageData = SwtUtils.loadImageData(in);
ctx = new SegmentationContext(imageData, file);
width = imageData.width;
}
else if (name.startsWith("markup")) {
- String[] temp;
- temp = name.split("-");
- int layerNumber = Integer.parseInt(temp[1].substring(0, temp[1].indexOf(".")));
SegmentationMask mask = new SegmentationMask(width,height);
- mask.layerNumber = layerNumber;
-
-
InputStream input = zip.getInputStream(entry);
segmentationMaskObjects.add(setMaskPixelValues(input,mask,width,height));
}
// getting collection ids
NodeList nlist = docEle.getElementsByTagName("segment");
noOfSegments = nlist.getLength();
- tempStorage = new String[nlist.getLength()][4];
+ noOfChildern = nlist.item(0).getChildNodes().getLength();
+ tempStorage = new String[noOfSegments][noOfChildern];
if(nlist != null && nlist.getLength() > 0)
{
for(int i = 0 ; i < nlist.getLength();i++)
}
}
- SegmentationView.speciesCombo.setText(speciesTermName);
+ SegmentationView.speciesCombo.setText(speciesTermName);
SegmentationView.speciesCombo.setData(speciesTermName,speciesTermId);
SegmentationView.curatorCombo.setText(curatorName);
SegmentationView.collectionId.setText(collectionId);
System.out.println("XML exception"+e.toString());
}
}
-
}
}
- catch(Exception ex)
+ catch(Exception e)
{
+ System.out.println("Exception is "+e.toString());
}
finally
{
for(int i = 0 ; i < noOfSegments;i++)
{
- for(int x = 0 ; x < 4;x++)
+ for(int x = 0 ; x < noOfChildern;x++)
{
if (x == 1)
{
if (isNewMaskDataRequired(mask)) {
mask.maskImageData = createMaskData(mask.getBounds());
}
+ byte main_index = 9;
// Blit in pixels
for (int y = 0, i = 0; y < mask.height; y++) {
int rowOffset = y * mask.maskImageData.bytesPerLine;
// the buffer), so we can't directly copy in at the same index as the
// mask.
mask.maskImageData.data[x + rowOffset] = index;
- //System.out.println(mask.maskImageData.data[x + rowOffset]);
+
// However, the alpha data is always aligned correctly
mask.maskImageData.alphaData[i] = alpha;
// Next location in the mask
i++;
+ main_index = index;
}
}
// Create new mask
}
public void dispose() {
- /*// Dispose mask
+/* // Dispose mask
if (maskImage != null) {
if (!maskImage.isDisposed()) {
maskImage.dispose();