ThreeB 1.1
|
Dialog box for starting 3B The dialog highlights bad things in red. More...
Public Member Functions | |
double | parseDouble (String s) |
void | textValueChanged (TextEvent e) |
Package Functions | |
ThreeBDialog (int count, int npix_, int nframes_) | |
int | parseInt (String s) |
TextField | getFWHMField () |
TextField | getPixelSizeField () |
TextField | getSpotsField () |
TextField | getFirstFrameField () |
TextField | getLastFrameField () |
double | getFWHM () |
double | getPixelSize () |
int | getSpots () |
int | getFirstFrame () |
int | getLastFrame () |
int | getCount () |
Package Attributes | |
int | count_ |
int | npix |
int | nframes |
Color | c |
Color | bg |
Dialog box for starting 3B The dialog highlights bad things in red.
Definition at line 432 of file three_B.java.
ThreeBDialog::ThreeBDialog | ( | int | count, |
int | npix_, | ||
int | nframes_ | ||
) | [inline, package] |
Definition at line 437 of file three_B.java.
References bg, c, count_, getFWHMField(), nframes, npix, and textValueChanged().
{ super("3B Analysis"); count_ = count; npix = npix_; nframes= nframes_; addNumericField("Microscope FWHM", 250.0, 1, 10, "nm"); addNumericField("Pixel size", 100., 1, 10, "nm"); addNumericField("Initial number of spots", Math.round(count / 10.), 0, 10, "spots"); addNumericField("First frame", 0., 0, 10, ""); addNumericField("Last frame", nframes-1., 0, 10, ""); addTextAreas("",null, 8,30); getTextArea1().setEditable(false); c = getFWHMField().getBackground(); //Get the default background colour bg = getBackground(); //Dialog background color getTextArea1().removeTextListener(this); //To prevent event thrashing when we write messages //Process initial warnings textValueChanged(null); }
double ThreeBDialog::parseDouble | ( | String | s | ) | [inline] |
Definition at line 460 of file three_B.java.
Referenced by getFWHM(), and getPixelSize().
{ try { return Double.parseDouble(s); } catch(Exception e) { return 0; } }
int ThreeBDialog::parseInt | ( | String | s | ) | [inline, package] |
Definition at line 471 of file three_B.java.
Referenced by getFirstFrame(), getLastFrame(), and getSpots().
{ try { return Integer.parseInt(s); } catch(Exception e) { return 0; } }
TextField ThreeBDialog::getFWHMField | ( | ) | [inline, package] |
Definition at line 483 of file three_B.java.
Referenced by getFWHM(), textValueChanged(), and ThreeBDialog().
{
return (TextField)(getNumericFields().get(0));
}
TextField ThreeBDialog::getPixelSizeField | ( | ) | [inline, package] |
Definition at line 487 of file three_B.java.
Referenced by getPixelSize(), and textValueChanged().
{
return (TextField)(getNumericFields().get(1));
}
TextField ThreeBDialog::getSpotsField | ( | ) | [inline, package] |
Definition at line 491 of file three_B.java.
Referenced by getSpots(), and textValueChanged().
{
return (TextField)(getNumericFields().get(2));
}
TextField ThreeBDialog::getFirstFrameField | ( | ) | [inline, package] |
Definition at line 495 of file three_B.java.
Referenced by getFirstFrame(), and textValueChanged().
{
return (TextField)(getNumericFields().get(3));
}
TextField ThreeBDialog::getLastFrameField | ( | ) | [inline, package] |
Definition at line 499 of file three_B.java.
Referenced by getLastFrame(), and textValueChanged().
{
return (TextField)(getNumericFields().get(4));
}
double ThreeBDialog::getFWHM | ( | ) | [inline, package] |
Definition at line 504 of file three_B.java.
References getFWHMField(), and parseDouble().
Referenced by textValueChanged().
{ return parseDouble(getFWHMField().getText()); }
double ThreeBDialog::getPixelSize | ( | ) | [inline, package] |
Definition at line 509 of file three_B.java.
References getPixelSizeField(), and parseDouble().
Referenced by textValueChanged().
{ return parseDouble(getPixelSizeField().getText()); }
int ThreeBDialog::getSpots | ( | ) | [inline, package] |
Definition at line 514 of file three_B.java.
References getSpotsField(), and parseInt().
Referenced by textValueChanged().
{ return parseInt(getSpotsField().getText()); }
int ThreeBDialog::getFirstFrame | ( | ) | [inline, package] |
Definition at line 519 of file three_B.java.
References getFirstFrameField(), and parseInt().
Referenced by textValueChanged().
{ return parseInt(getFirstFrameField().getText()); }
int ThreeBDialog::getLastFrame | ( | ) | [inline, package] |
Definition at line 524 of file three_B.java.
References getLastFrameField(), and parseInt().
Referenced by textValueChanged().
{ return parseInt(getLastFrameField().getText()); }
int ThreeBDialog::getCount | ( | ) | [inline, package] |
Definition at line 529 of file three_B.java.
References count_.
Referenced by textValueChanged().
{ return count_; }
void ThreeBDialog::textValueChanged | ( | TextEvent | e | ) | [inline] |
Definition at line 534 of file three_B.java.
References bg, c, getCount(), getFirstFrame(), getFirstFrameField(), getFWHM(), getFWHMField(), getLastFrame(), getLastFrameField(), getPixelSize(), getPixelSizeField(), getSpots(), getSpotsField(), nframes, and npix.
Referenced by ThreeBDialog().
{ boolean long_run=false; String err = ""; // 012345678901234567890123456789012345678901234567890 if(getCount() > 1000) { long_run=true; err = err + "Warning: large area selected.\n3B will run very slowly.\n"; } if(npix < 2500) err = err + "Warning: image is very small. Fitting may be bad because\nimage noise cannot be accurately estimated.\n"; if(getSpots() > 500) { err = err + "Warning: large number of spots.\n3B will run very slowly.\n"; getSpotsField().setBackground(Color.RED); } else getSpotsField().setBackground(c); if(getFWHM() < 200) { err = err + "Warning: unrealistically small\nmicsoscope resolution.\n"; getFWHMField().setBackground(Color.RED); } else if(getFWHM() > 350) { err = err + "Warning: 3B will not work well with\na poorly focussed microscope.\n"; getFWHMField().setBackground(Color.RED); } else getFWHMField().setBackground(c); if(getPixelSize() < 70) { getPixelSizeField().setBackground(Color.RED); err = err + "Warning: Very small pixels specified.\nAre you sure?\n"; } else if(getPixelSize() > 180) { getPixelSizeField().setBackground(Color.RED); err = err + "Warning: 3B will not work well if the camera\nresolution is too poor.\n"; } else getPixelSizeField().setBackground(c); //Clamp the frames int first = getFirstFrame(); int last = getLastFrame(); int nfirst = Math.max(0, Math.min(nframes-1, first)); int nlast = Math.max(nfirst, Math.min(nframes-1, last)); if(first != nfirst) getFirstFrameField().setText(Integer.toString(nfirst)); if(last != nlast) getLastFrameField().setText(Integer.toString(nlast)); if(last -first + 1 > 500) { getFirstFrameField().setBackground(Color.RED); getLastFrameField().setBackground(Color.RED); err = err + "Warning: large number of frames specified.\n3B will run very slowly and may be inaccurate.\nFewer than 500 frames is strongly recommended.\n200--300 is generally most suitable.\n"; long_run = true; } if(last -first + 1 < 150) { getFirstFrameField().setBackground(Color.RED); getLastFrameField().setBackground(Color.RED); err = err + "Warning: small number of frames specified.\n3B may be inaccurate.\nAt least 150 frames is recommended.\n"; } else { getFirstFrameField().setBackground(c); getLastFrameField().setBackground(c); } if(!long_run && (last -first + 1)*getCount() > 200000) { err = err + "Warning: large amount of data specified.\n"+ "3B will run very slowly.\n"+ "Reduce the area and/or number of frames.\n"+ "We recommend: \n" + "Number of frames*area in pixels < 200,000."; getFirstFrameField().setBackground(Color.RED); getLastFrameField().setBackground(Color.RED); } if(!err.equals("")) getTextArea1().setBackground(Color.RED); else getTextArea1().setBackground(bg); getTextArea1().setText(err); repaint(); }
int ThreeBDialog::count_ [package] |
Definition at line 434 of file three_B.java.
Referenced by getCount(), and ThreeBDialog().
int ThreeBDialog::npix [package] |
Definition at line 434 of file three_B.java.
Referenced by textValueChanged(), and ThreeBDialog().
int ThreeBDialog::nframes [package] |
Definition at line 434 of file three_B.java.
Referenced by textValueChanged(), and ThreeBDialog().
Color ThreeBDialog::c [package] |
Definition at line 435 of file three_B.java.
Referenced by textValueChanged(), and ThreeBDialog().
Color ThreeBDialog::bg [package] |
Definition at line 435 of file three_B.java.
Referenced by textValueChanged(), and ThreeBDialog().