本文整理汇总了Java中ij.gui.ImageWindow类的典型用法代码示例。如果您正苦于以下问题:Java ImageWindow类的具体用法?Java ImageWindow怎么用?Java ImageWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageWindow类属于ij.gui包,在下文中一共展示了ImageWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRoiBox
import ij.gui.ImageWindow; //导入依赖的package包/类
/**
* Create JComboBox for selecting ROIs created in ImageJ.
* @return
*/
public static JComboBox<String> createRoiBox(){
String[] imageTitles = WindowManager.getImageTitles();
ArrayList<String> elements = new ArrayList<String>(imageTitles.length);
for(String s: imageTitles){
ImagePlus ip = WindowManager.getImage(s);
Roi roi = ip.getRoi();
if(roi != null){
elements.add(s);
}
}
JComboBox<String> roiBox = new JComboBox<String>(imageTitles);
roiBox.setEditable(false);
roiBox.setMaximumRowCount(BOXSIZE);
ImageWindow win = WindowManager.getCurrentWindow();
if(win != null){
if(elements.contains(win.getTitle())){
roiBox.setSelectedItem(win.getName());
}
}
return roiBox;
}
示例2: setKeyUp
import ij.gui.ImageWindow; //导入依赖的package包/类
public static void setKeyUp(int key) {
if (debugMode) IJJazzOMR.log("setKeyUp: "+key);
switch (key) {
case KeyEvent.VK_CONTROL: controlDown=false; break;
case KeyEvent.VK_META: if (isMacintosh()) controlDown=false; break;
case KeyEvent.VK_ALT: altDown=false; break;
case KeyEvent.VK_SHIFT: shiftDown=false; if (debugMode) beep(); break;
case KeyEvent.VK_SPACE:
spaceDown=false;
ImageWindow win = WindowManager.getCurrentWindow();
if (win!=null) win.getCanvas().setCursor(-1,-1,-1,-1);
break;
case ALL_KEYS:
shiftDown=controlDown=altDown=spaceDown=false;
break;
}
}
示例3: selectWindow
import ij.gui.ImageWindow; //导入依赖的package包/类
/** Activates the window with the specified title. */
public static void selectWindow(String title) {
if (title.equals("ImageJ")&&ij!=null)
{ij.toFront(); return;}
long start = System.currentTimeMillis();
while (System.currentTimeMillis()-start<3000) { // 3 sec timeout
Frame frame = WindowManager.getFrame(title);
if (frame!=null && !(frame instanceof ImageWindow)) {
selectWindow(frame);
return;
}
int[] wList = WindowManager.getIDList();
int len = wList!=null?wList.length:0;
for (int i=0; i<len; i++) {
ImagePlus imp = WindowManager.getImage(wList[i]);
if (imp!=null) {
if (imp.getTitle().equals(title)) {
selectWindow(imp.getID());
return;
}
}
}
wait(10);
}
error("Macro Error", "No window with the title \""+title+"\" found.");
}
示例4: showImage
import ij.gui.ImageWindow; //导入依赖的package包/类
public static void showImage(
final String title,
final double [] array,
final int Ydim,
final int Xdim
) {
final FloatProcessor fp=new FloatProcessor(Xdim,Ydim);
int ij=0;
for (int i=0; i<Ydim; i++)
for (int j=0; j<Xdim; j++, ij++)
fp.putPixelValue(j,i,array[ij]);
fp.resetMinAndMax();
final ImagePlus ip=new ImagePlus(title, fp);
final ImageWindow iw=new ImageWindow(ip);
ip.updateImage();
}
示例5: killListeners
import ij.gui.ImageWindow; //导入依赖的package包/类
/**
* Kill listeners.
*/
public void killListeners ()
{
if(imp != null)
{
final ImageWindow iw = imp.getWindow();
final ImageCanvas ic = iw.getCanvas();
ic.removeKeyListener(pa);
ic.removeMouseListener(pa);
ic.removeMouseMotionListener(pa);
ic.addMouseMotionListener(ic);
ic.addMouseListener(ic);
ic.addKeyListener(IJ.getInstance());
}
}
示例6: loadImageData
import ij.gui.ImageWindow; //导入依赖的package包/类
/** Load the index of images */
private void loadImageData() throws SlideSetException {
final List<ColumnBoundReader> iCbrs;
iCbrs = dtid.getCompatableColumnReaders(ImageWindow.class, slideSet);
if (iCbrs == null || iCbrs.isEmpty()) {
JOptionPane.showMessageDialog(this,
"This table does not contain any images. "
+ "Cannot create ROIs.",
"SlideSet - ROI Editor",
JOptionPane.ERROR_MESSAGE);
active = false;
throw new OperationCanceledException("No images in table.");
}
imageReaders = new ArrayList<ColumnBoundReader<? extends DataElement, ImageWindow>>();
imageSetNames = new ArrayList<String>();
for(ColumnBoundReader r : iCbrs) {
imageReaders.add(r);
imageSetNames.add(r.getColumnName());
}
}
示例7: showTemplateImage
import ij.gui.ImageWindow; //导入依赖的package包/类
/**
* Show template image.
*
* @param name
* the name
*/
private void showTemplateImage(String name)
{
ImagePlus imp = getTemplateImage(name);
if (imp == null)
{
IJ.error(TITLE, "Failed to load example image for template: " + name);
}
else
{
this.imp = displayTemplate(TITLE, imp);
if (Utils.isNewWindow())
{
// Zoom a bit
ImageWindow iw = this.imp.getWindow();
for (int i = 7; i-- > 0 && Math.max(iw.getWidth(), iw.getHeight()) < 512;)
{
iw.getCanvas().zoomIn(0, 0);
}
}
createResults(this.imp);
showTemplateInfo(name);
}
}
示例8: segment
import ij.gui.ImageWindow; //导入依赖的package包/类
/**
* Segment current image (GUI needs to be running)
*
* @param dynamic string containing dynamic value (format: "dynamic=[integer value]")
* @param calculateDams string containing boolean flag to create dams (format: "calculateDams=[boolean])
* @param connectivity string containing connectivity value (format: "connectivity=[4 or 8 / 6 or 26])
* @param usePriorityQueue string containing boolean flag to use priority queue (format: "usePriorityQueue=[boolean])
*
* @deprecated the priority queue method is now the only one
*/
public static void segment(
String dynamic,
String calculateDams,
String connectivity,
String usePriorityQueue )
{
final ImageWindow iw = WindowManager.getCurrentImage().getWindow();
if( iw instanceof CustomWindow )
{
//IJ.log( "GUI detected" );
final CustomWindow win = (CustomWindow) iw;
win.setDynamic( Double.parseDouble( dynamic.replace( "tolerance=", "" ) ) );
win.setCalculateDams( calculateDams.contains( "true" ) );
win.setConnectivity( Integer.parseInt( connectivity.replace( "connectivity=", "" ) ) );
win.runSegmentation( win.getSegmentText() );
}
else
IJ.log( "Error: Morphological Segmentation GUI not detected." );
}
示例9: segment
import ij.gui.ImageWindow; //导入依赖的package包/类
/**
* Segment current image (GUI needs to be running)
*
* @param calculateDams string containing boolean flag to create dams (format: "calculateDams=[boolean])
* @param connectivity string containing connectivity value (format: "connectivity=[4 or 8 / 6 or 26])
*/
public static void segment(
String calculateDams,
String connectivity )
{
final ImageWindow iw = WindowManager.getCurrentImage().getWindow();
if( iw instanceof CustomWindow )
{
final CustomWindow win = (CustomWindow) iw;
win.setCalculateDams( calculateDams.contains( "true" ) );
win.setConnectivity( Integer.parseInt( connectivity.replace( "connectivity=", "" ) ) );
win.runSegmentation( win.getSegmentText() );
}
else
IJ.log( "Error: Interactive Marker-controlled Watershed GUI not detected." );
}
示例10: getPlots
import ij.gui.ImageWindow; //导入依赖的package包/类
private ArrayList<PlotInstance> getPlots() {
final ArrayList<PlotInstance> plots = new ArrayList<>();
final int[] ids = WindowManager.getIDList();
if (ids != null) {
for (final int id : ids) {
final ImagePlus pImp = WindowManager.getImage(id);
if (pImp == null)
continue;
final ImageWindow win = pImp.getWindow();
if (win == null)
continue;
if (win instanceof PlotWindow) {
if (win.equals(pw))
continue;
plots.add(new PlotInstance((PlotWindow) win));
}
}
}
return plots;
}
示例11: createMatBox
import ij.gui.ImageWindow; //导入依赖的package包/类
/**
* Create input ComboBox for ImageJ images.
* @return
*/
public static JComboBox<String> createMatBox(){
String[] imageTitles = WindowManager.getImageTitles();
JComboBox<String> matBox = new JComboBox<String>(imageTitles);
matBox.setEditable(false);
matBox.setMaximumRowCount(BOXSIZE);
ImageWindow win = WindowManager.getCurrentWindow();
if(win != null){
matBox.setSelectedItem(win.getName());
}
return matBox;
}
示例12: cancelSource
import ij.gui.ImageWindow; //导入依赖的package包/类
private double[][] cancelSource(final turboRegPointHandler sourcePh)
{
stopSourceThreads();
if (sourceScrollbar != null)
{
sourceScrollbar.removeAdjustmentListener(sourcePa);
sourceScrollbar = null;
}
final ImageWindow iw = sourceImp.getWindow();
iw.removeKeyListener(sourcePa);
sourceIc.removeKeyListener(sourcePa);
sourceIc.removeMouseMotionListener(sourcePa);
sourceIc.removeMouseListener(sourcePa);
sourceIc.addMouseListener(sourceIc);
sourceIc.addMouseMotionListener(sourceIc);
sourceIc.addKeyListener(IJ.getInstance());
iw.addKeyListener(IJ.getInstance());
sourceIc = null;
sourceImp.killRoi();
sourceImp.updateAndDraw();
sourceImp = null;
sourceImg = null;
sourceMsk = null;
sourcePa = null;
sourceScrollbar = null;
return (sourcePh.getPoints());
}
示例13: cancelTarget
import ij.gui.ImageWindow; //导入依赖的package包/类
private double[][] cancelTarget(final turboRegPointHandler targetPh)
{
stopTargetThreads();
if (targetScrollbar != null)
{
targetScrollbar.removeAdjustmentListener(targetPa);
targetScrollbar = null;
}
final ImageWindow iw = targetImp.getWindow();
iw.removeKeyListener(targetPa);
targetIc.removeKeyListener(targetPa);
targetIc.removeMouseMotionListener(targetPa);
targetIc.removeMouseListener(targetPa);
targetIc.addMouseListener(targetIc);
targetIc.addMouseMotionListener(targetIc);
targetIc.addKeyListener(IJ.getInstance());
iw.addKeyListener(IJ.getInstance());
targetIc = null;
targetImp.killRoi();
targetImp.updateAndDraw();
targetImp = null;
targetImg = null;
targetMsk = null;
targetPa = null;
targetScrollbar = null;
return (targetPh.getPoints());
}
示例14: setKeyDown
import ij.gui.ImageWindow; //导入依赖的package包/类
public static void setKeyDown(int key) {
if (debugMode) IJJazzOMR.log("setKeyDown: "+key);
switch (key) {
case KeyEvent.VK_CONTROL:
controlDown=true;
break;
case KeyEvent.VK_META:
if (isMacintosh()) controlDown=true;
break;
case KeyEvent.VK_ALT:
altDown=true;
break;
case KeyEvent.VK_SHIFT:
shiftDown=true;
if (debugMode) beep();
break;
case KeyEvent.VK_SPACE: {
spaceDown=true;
ImageWindow win = WindowManager.getCurrentWindow();
if (win!=null) win.getCanvas().setCursor(-1,-1,-1, -1);
break;
}
case KeyEvent.VK_ESCAPE: {
escapePressed = true;
break;
}
}
}
示例15: run
import ij.gui.ImageWindow; //导入依赖的package包/类
/*********************************************************************
* Perform the registration
********************************************************************/
public void run (
) {
// Create output image
int Ydimt=target.getHeight();
int Xdimt=target.getWidth();
int Xdims=source.getWidth();
final FloatProcessor fp=new FloatProcessor(Xdimt,Ydimt);
for (int i=0; i<Ydimt; i++)
for (int j=0; j<Xdimt; j++)
if (sourceMsk.getValue(j,i) && targetMsk.getValue(j,i))
fp.putPixelValue(j,i,(target.getImage())[i*Xdimt+j]-
(source.getImage())[i*Xdims+j]);
else fp.putPixelValue(j,i,0);
fp.resetMinAndMax();
final ImagePlus ip=new ImagePlus("Output", fp);
final ImageWindow iw=new ImageWindow(ip);
ip.updateImage();
// Perform the registration
final unwarpJTransformation warp = new unwarpJTransformation(
sourceImp, targetImp, source, target, sourcePh, targetPh,
sourceMsk, targetMsk, min_scale_deformation, max_scale_deformation,
min_scale_image, divWeight, curlWeight, landmarkWeight, imageWeight,
stopThreshold, outputLevel, showMarquardtOptim, accurate_mode,
dialog.isSaveTransformationSet(), "", ip, dialog);
warp.doRegistration();
dialog.ungrayImage(sourcePh.getPointAction());
dialog.ungrayImage(targetPh.getPointAction());
dialog.restoreAll();
dialog.freeMemory();
}