本文整理汇总了Java中ij.text.TextPanel类的典型用法代码示例。如果您正苦于以下问题:Java TextPanel类的具体用法?Java TextPanel怎么用?Java TextPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextPanel类属于ij.text包,在下文中一共展示了TextPanel类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeHeader
import ij.text.TextPanel; //导入依赖的package包/类
void writeHeader(final TextPanel textPanel) {
final String[] propertyNames = { "File Name", "File Path", "Patient's Name", "Patient ID",
"Patient's Birth Date", "Acquisition Date", "Pixel Spacing", "Object Length" };
String headings = "";
for (int i = 0; i < propertyNames.length; ++i) {
headings += propertyNames[i] + "\t";
}
textPanel.setColumnHeadings(headings);
}
示例2: ImageROIPainter
import ij.text.TextPanel; //导入依赖的package包/类
/**
* @param textPanel
* The text panel to listen to for mouse events
* @param title
* The title of the image to add the ROI to
* @param coordProvider
* Provides coordinates from the lines selected in the text panel
*/
public ImageROIPainter(TextPanel textPanel, String title, CoordinateProvider coordProvider)
{
// Check if the image is displayed
this.title = title;
this.textPanel = textPanel;
this.coordProvider = coordProvider;
textPanel.addMouseListener(this);
}
示例3: clusterSelected
import ij.text.TextPanel; //导入依赖的package包/类
public void clusterSelected(ClusterSelectedEvent e)
{
if (tw == null || e.getSource() == id)
return;
if (!inputSettings.getOpticsEventSettingsOrBuilder().getTableShowSelection())
return;
TextPanel textPanel = tw.getTextPanel();
int startLine = -1, endLine = -1;
int[] clusters = e.getClusters();
if (clusters == null || clusters.length == 0)
{
textPanel.resetSelection();
}
else
{
// Find the clusters.
// Assume that the panel is showing the current results.
for (int i = 0; i < tableResults.size(); i++)
{
TableResult r = tableResults.getf(i);
if (r.id == clusters[0])
{
// We can only handle selecting continuous lines so
// for now just select the first cluster.
startLine = endLine = i;
break;
}
}
}
if (startLine != -1)
{
textPanel.setSelection(startLine, endLine);
}
}
示例4: createDialog
import ij.text.TextPanel; //导入依赖的package包/类
private GenericDialog createDialog()
{
// Get the list of windows containing tables
TextWindow[] textWindows = getTableWindows();
if (textWindows.length == 0)
{
IJ.error("Requires at least one Table window");
return null;
}
String[] tableNames = new String[textWindows.length];
for (int i = 0; i < textWindows.length; i++) {
tableNames[i] = textWindows[i].getTitle();
// IJ.log("Found table: " + tableNames[i]);
}
// Choose current table
TextPanel tp = textWindows[0].getTextPanel();
ResultsTable table = tp.getResultsTable();
this.table = table;
// Choose current heading
String[] headings = table.getHeadings();
String defaultHeading = headings[0];
if (defaultHeading.equals("Label") && headings.length > 1)
{
defaultHeading = headings[1];
}
double[] extent = computeColumnExtent(table, defaultHeading);
this.gd = new GenericDialog("Assign Measure to Label");
gd.addChoice("Results Table:", tableNames, tableNames[0]);
gd.addChoice("Column:", headings, defaultHeading);
gd.addNumericField("Min Value", extent[0], this.nDigits, 10, null);
gd.addNumericField("Max Value", extent[1], this.nDigits, 10, null);
gd.addDialogListener(this);
return gd;
}
示例5: removeAfterLine
import ij.text.TextPanel; //导入依赖的package包/类
private void removeAfterLine(TextWindow window, int line)
{
if (window != null && line > 0)
{
TextPanel tp = window.getTextPanel();
int nLines = tp.getLineCount();
if (line < nLines)
{
tp.setSelection(line, nLines);
tp.clearSelection();
}
}
}
示例6: getTextPanel
import ij.text.TextPanel; //导入依赖的package包/类
/** Returns a reference to the "Results" window TextPanel.
Opens the "Results" window if it is currently not open.
Returns null if the "ImageJ" window is not open. */
public static TextPanel getTextPanel() {
if (textPanel==null && ij!=null)
showResults();
return textPanel;
}
示例7: setTextPanel
import ij.text.TextPanel; //导入依赖的package包/类
/** TextWindow calls this method with a null argument when the "Results" window is closed. */
public static void setTextPanel(TextPanel tp) {
textPanel = tp;
}
示例8: run
import ij.text.TextPanel; //导入依赖的package包/类
public void run(ImageProcessor ip) {
int npts;
double[] x, y;
// Obtains the coordinates of the points from the Results window
TextPanel resultsWindow = IJ.getTextPanel();
npts = resultsWindow.getLineCount();
if (npts <= 0) {
IJ.log("ERROR: no point coordinates found.");
IJ.log("INSTRUCTIONS: Use the crosshair tool to mark all desired points of ablation"
+ "before executing Point and Shoot.\n This plugin will ablate "
+ "all points listed in the Results window.\n Clear the window "
+ "beforehand if necessary.");
IJ.log("\nDONE\n");
return;
}
x = new double[npts];
y = new double[npts];
for (int i = 0; i < npts; i++) {
StringTokenizer line = new StringTokenizer(resultsWindow.getLine(i), "\t");
line.nextToken();
x[i] = Double.parseDouble(line.nextToken());
y[i] = Double.parseDouble(line.nextToken());
}
// Displays a dialog box to allow the user to configure the experimental parameters
double reprate = 10;
int npulses = 1;
int zoom = 1;
GenericDialog gd = new GenericDialog("Experimental Parameters");
gd.addNumericField("Laser Repetition Rate (Hz): ", reprate, 0);
gd.addNumericField("Number of Ablation Pulses: ", npulses, 0);
gd.addNumericField("Digital Zoom of Image: ", zoom, 0);
gd.addMessage("");
gd.addMessage("Check targeting on image. Cancel plugin if incorrect.");
gd.showDialog();
if (gd.wasCanceled()) {
IJ.error("Point_and_Shoot PlugIn canceled!");
return;
}
reprate = gd.getNextNumber();
npulses = (int) gd.getNextNumber();
zoom = (int) gd.getNextNumber();
double period = 1000 / reprate; //period in ms
int opentime = (int) ( period * (npulses-0.05) );
// Initializes the microbeam
Microbeam microbeam = new Microbeam(Microbeam.CONFIG_FILENAME);
if (!microbeam.isSetupOK()) return;
/** LASER INCISION **/
// Iterate over each point, and make a point ablation
IJ.wait(500);
for (int i = 0; i < npts; i++) {
if (!win.running) break;
// move microbeam to position i
microbeam.moveToPIXELS(x[i], y[i], ip, zoom);
microbeam.openShutter();
IJ.wait(opentime);
microbeam.closeShutter();
// draw point of ablation on display image
ip.setColor(Color.white); ip.setLineWidth(3); // set line width and color
ip.drawDot((int) x[i], (int) y[i]);
imp.updateAndDraw();
}
// Moves microbeam to home and turns it off
microbeam.moveToMM(0.0, 0.0);
microbeam.off();
IJ.log("\nDONE\n");
}
示例9: run
import ij.text.TextPanel; //导入依赖的package包/类
public void run(ImageProcessor ip) {
ip.snapshot();
// Obtains the coordinates of the points from the Results window
TextPanel resultsWindow = IJ.getTextPanel();
try {
numpoints = resultsWindow.getLineCount();
if (numpoints <= 0) throw new IllegalArgumentException();
x = new double[numpoints];
y = new double[numpoints];
for (int i = 0; i < numpoints; i++) {
StringTokenizer line = new StringTokenizer(resultsWindow.getLine(i), "\t");
line.nextToken();
x[i] = Double.parseDouble(line.nextToken());
y[i] = Double.parseDouble(line.nextToken());
}
} catch (RuntimeException e) {
IJ.showMessage("Invalid point selection",
"Use the crosshair tool to mark all desired points of ablation before executing Point and Shoot.\n" +
"This plugin will ablate all points listed in the Results window.\n" +
"Clear the window beforehand if necessary.");
return;
}
// Displays a dialog box to allow the user to configure the experimental parameters
double reprate = 10;
int npulses = 1;
int zoom = 1;
GenericDialog gd = new GenericDialog("Experimental Parameters");
gd.addNumericField("Laser Repetition Rate (Hz): ", reprate, 0);
gd.addNumericField("Number of Ablation Pulses: ", npulses, 0);
gd.addNumericField("Digital Zoom of Image: ", zoom, 0);
gd.addMessage("");
gd.addMessage("Check targeting on image. Cancel plugin if incorrect.");
gd.showDialog();
if (gd.wasCanceled()) {
IJ.error("PlugIn canceled!");
ip.reset();
imp.updateAndDraw();
return;
}
reprate = gd.getNextNumber();
npulses = (int) gd.getNextNumber();
zoom = (int) gd.getNextNumber();
double period = (1000/reprate); //period in ms
int opentime = (int) (period*(npulses-0.05 ));
IJ.setColumnHeadings("");
// Initializes the microbeam
Microbeam microbeam = new Microbeam(Microbeam.CONFIG_FILENAME);
if(!microbeam.isSetupOK()) return;
// Moves to each point and exposes it for the specified number of pulses
for(int j = 0; j < 3; j++) {
IJ.beep();
IJ.wait(500);
}
ip.setLineWidth(3);
ip.setColor(Color.white);
for (int i = 0; i < numpoints; i++) {
microbeam.moveToPIXELS(x[i], y[i], ip, zoom);
if (!win.running) break;
microbeam.openShutter();
IJ.wait(opentime);
microbeam.closeShutter();
ip.drawDot((int) x[i], (int) y[i]);
imp.updateAndDraw();
}
// Resets the microbeam
microbeam.moveToMM(0.0, 0.0);
microbeam.off();
IJ.write("\nDONE\n");
}