Skip to content

Commit

Permalink
Added info about loaded ROIs
Browse files Browse the repository at this point in the history
  • Loading branch information
CellDynamics committed Jan 11, 2018
1 parent f6c7adf commit 0cecffe
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
Expand Up @@ -295,13 +295,11 @@ public void actionPerformed(ActionEvent e) {
}
RandomWalkModel model = (RandomWalkModel) options;
model.getOriginalImage().deleteRoi(); // just in case if ROI tool left something
// TODO add info about found ROIs - but this listener is called first before seedsRoi
// JLabel lab = view.getLroiSeedsInfo();
// List<Seeds> rois = seedPickerWnd.seedsRoi;
// if (rois != null) {
// lab.setText(rois.get(0).get(SeedTypes.FOREGROUNDS).size() + " FG and "
// + rois.get(0).get(SeedTypes.BACKGROUND).size() + " BG objects");
// }
List<Seeds> rois = seedPickerWnd.seedsRoi;
if (rois != null) {
view.setLroiSeedsInfo("Objects: " + rois.get(0).get(SeedTypes.FOREGROUNDS).size()
+ " FG and " + rois.get(0).get(SeedTypes.BACKGROUND).size() + " BG");
}
}

}
Expand Down
Expand Up @@ -312,12 +312,14 @@ public void setCbCreatedSeedImage(String[] item, String sel) {
private JLabel lbRoiSeedsInfo;

/**
* Getter for lRoiSeedsInfo
* Set ROP info.
*
* @return lRoiSeedsInfo
* @param lab name to set
*/
public JLabel getLroiSeedsInfo() {
return lbRoiSeedsInfo;
public void setLroiSeedsInfo(String lab) {
lbRoiSeedsInfo.setFont(new Font(lbRoiSeedsInfo.getFont().getName(), Font.ITALIC,
lbRoiSeedsInfo.getFont().getSize()));
lbRoiSeedsInfo.setText(lab);
}

// optionsPanel
Expand Down Expand Up @@ -876,6 +878,8 @@ public RandomWalkView() {
cbMaskSeedImage = new JComboBox<String>();
bnQconfSeedImage = new JButton("Load");
bnQconfShowSeedImage = new JButton("Show");
UiTools.setToolTip(bnQconfShowSeedImage, "Show mask generated from loaded QCONF file.");
UiTools.setToolTip(bnQconfSeedImage, "Load mask from QCONF file.");
bnClone = new JButton("Clone");
UiTools.setToolTip(bnClone, "Clone selected original image.");
bnSeedRoi = new JButton("Seed");
Expand Down Expand Up @@ -1403,8 +1407,6 @@ private JPanel getQconfImage() {
upperrow.add(bnQconfShowSeedImage, constrProc);
dynPanel.add(upperrow);
dynPanel.add(lbQconfFile);
UiTools.setToolTip(bnQconfShowSeedImage, "Show mask generated from loaded QCONF file.");
UiTools.setToolTip(bnQconfSeedImage, "Load mask from QCONF file.");

return dynPanel;
}
Expand Down
Expand Up @@ -64,7 +64,8 @@ public class SeedPicker extends JFrame {
private int lastLineWidth;
private int lastFgNum = 0; // cell number
private int lastBgNum = 0; // but this is index, cell is always 0 for BG

// For Finish button we need specific order of ActionListeners
private ActionListener[] bnFinishListeners = new ActionListener[2];
/**
* Converted seeds available after Finish.
*/
Expand Down Expand Up @@ -158,7 +159,8 @@ public void actionPerformed(ActionEvent e) {
contentPane.add(btnBackground);

btnFinish = new JButton("Finish");
btnFinish.addActionListener(new ActionListener() {
// this listener should go first, before that from RandomWalkView
bnFinishListeners[0] = new ActionListener() {

@Override
public void actionPerformed(ActionEvent e) {
Expand All @@ -176,6 +178,14 @@ public void actionPerformed(ActionEvent e) {
}

}
};
btnFinish.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent e) {
bnFinishListeners[0].actionPerformed(e);
bnFinishListeners[1].actionPerformed(e);
}
});

contentPane.add(btnFinish);
Expand Down Expand Up @@ -209,8 +219,15 @@ public void windowClosed(WindowEvent e) {
pack();
}

/**
* Add Listener to Finish button that is executed as second.
*
* <p>First listener prepares {@link SeedPicker#seedsRoi} structure, so second one can use it.
*
* @param list listener to add as second
*/
void addFinishController(ActionListener list) {
btnFinish.addActionListener(list);
bnFinishListeners[1] = list;
}

/**
Expand Down

0 comments on commit 0cecffe

Please sign in to comment.