本文整理匯總了Java中net.imagej.display.DatasetView類的典型用法代碼示例。如果您正苦於以下問題:Java DatasetView類的具體用法?Java DatasetView怎麽用?Java DatasetView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DatasetView類屬於net.imagej.display包,在下文中一共展示了DatasetView類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: changeDisplayMode
import net.imagej.display.DatasetView; //導入依賴的package包/類
/** Update the color mode */
private void changeDisplayMode() {
ColorMode m;
switch(displayMode.getSelectedIndex()) {
default:
case 0:
m = ColorMode.COMPOSITE;
break;
case 1:
m = ColorMode.GRAYSCALE;
break;
case 2:
m = ColorMode.COLOR;
}
for(DataView v : imageDisplay) {
if(!DatasetView.class.isInstance(v)) continue;
((DatasetView)v).setColorMode(m);
}
imageDisplay.update();
}
示例2: DatasetFigureView
import net.imagej.display.DatasetView; //導入依賴的package包/類
public DatasetFigureView(final SwingImageDisplayViewer displayViewer,
final DatasetView datasetView)
{
setContext(datasetView.getContext());
this.datasetView = datasetView;
final JHotDrawImageCanvas canvas = displayViewer.getCanvas();
final Drawing drawing = canvas.getDrawing();
figure = new ImageFigure();
figure.setSelectable(false);
figure.setTransformable(false);
final Dataset dataset = datasetView.getData();
final double minX = dataset.getImgPlus().realMin(0);
final double minY = dataset.getImgPlus().realMin(1);
final double maxX = dataset.getImgPlus().realMax(0);
final double maxY = dataset.getImgPlus().realMax(1);
figure.setBounds(new Point2D.Double(minX, minY), new Point2D.Double(maxX,
maxY));
drawing.add(figure);
}
示例3: registerBrightnessContrast
import net.imagej.display.DatasetView; //導入依賴的package包/類
/** Register a Brightness/Contrast dialog */
public void registerBrightnessContrast(BrightnessContrastRoi bc) {
bcDialog = bc;
if(imageDisplay == null || bcDialog == null) return;
for(DataView v : imageDisplay) {
if(!DatasetView.class.isInstance(v)) continue;
bcDialog.setView((DatasetView)v);
return;
}
}
示例4: redraw
import net.imagej.display.DatasetView; //導入依賴的package包/類
@Override
public void redraw() {
final DatasetView view = imageDisplayService.getActiveDatasetView(display);
if (view == null || view.getProjector() == null) return; // no active dataset
view.getProjector().map();
displayViewer.getCanvas().update();
}
示例5: updateColorBar
import net.imagej.display.DatasetView; //導入依賴的package包/類
private void updateColorBar(final int c) {
final DatasetView view = imageDisplayService.getActiveDatasetView(display);
if (view == null) return; // no active dataset
List<ColorTable> colorTables = view.getColorTables();
if (c >= colorTables.size()) return;
final ColorTable lut = colorTables.get(c);
colorBar.setColorTable(lut);
colorBar.repaint();
}
示例6: toOMERO
import net.imagej.display.DatasetView; //導入依賴的package包/類
@Override
public Object toOMERO(final omero.client client, final Object value)
throws omero.ServerError, IOException, PermissionDeniedException,
CannotCreateSessionException, ExecutionException, DSOutOfServiceException,
DSAccessException
{
if (value instanceof Dataset) {
// upload image to OMERO, returning the resultant image ID
final long imageID = uploadImage(client, (Dataset) value);
return toOMERO(client, imageID);
}
if (value instanceof DatasetView) {
final DatasetView datasetView = (DatasetView) value;
// TODO: Verify whether any view-specific metadata can be preserved.
return toOMERO(client, datasetView.getData());
}
if (value instanceof ImageDisplay) {
final ImageDisplay imageDisplay = (ImageDisplay) value;
// TODO: Support more aspects of image displays; e.g., multiple datasets.
return toOMERO(client, imageDisplayService.getActiveDataset(imageDisplay));
}
if (value instanceof Table) {
return convertOMEROTable((Table<?, ?>) value);
}
if (value instanceof TableDisplay) {
return toOMERO(client, ((TableDisplay) value).get(0));
}
return toOMERO(value);
}
示例7: getSingleImage
import net.imagej.display.DatasetView; //導入依賴的package包/類
/**
* Scans the given list of parameters for a single item of image type (i.e., a
* {@link Dataset}, {@link DatasetView} or {@link ImageDisplay}). This is
* useful so that such items can be assigned a special name for the benefit of
* OMERO clients.
*/
private ModuleItem<?> getSingleImage(final Iterable<ModuleItem<?>> items) {
ModuleItem<?> imageItem = null;
for (final ModuleItem<?> item : items) {
final Class<?> type = item.getType();
if (Dataset.class.isAssignableFrom(type) || DatasetView.class
.isAssignableFrom(type) || ImageDisplay.class.isAssignableFrom(type))
{
if (imageItem == null) imageItem = item;
else return null; // multiple image parameters
}
}
return imageItem;
}
示例8: getView
import net.imagej.display.DatasetView; //導入依賴的package包/類
public DatasetView getView() {
return view;
}
示例9: setView
import net.imagej.display.DatasetView; //導入依賴的package包/類
public void setView(final DatasetView view) {
this.view = view;
}
示例10: getDataView
import net.imagej.display.DatasetView; //導入依賴的package包/類
@Override
public DatasetView getDataView() {
return datasetView;
}
示例11: capture
import net.imagej.display.DatasetView; //導入依賴的package包/類
/**
* Captures the current view of data displayed in the canvas, including all
* JHotDraw embellishments.
*/
public Dataset capture() {
final ImageDisplay display = getDisplay();
if (display == null) return null;
final DatasetView datasetView =
imageDisplayService.getActiveDatasetView(display);
if (datasetView == null) return null;
final ARGBScreenImage screenImage = datasetView.getScreenImage();
final Image pixels = screenImage.image();
final int w = pixels.getWidth(null);
final int h = pixels.getHeight(null);
// draw the backdrop image info
final BufferedImage outputImage =
new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
final Graphics2D outputGraphics = outputImage.createGraphics();
outputGraphics.drawImage(pixels, 0, 0, null);
// draw the overlay info
for (final FigureView view : figureViews) {
view.getFigure().draw(outputGraphics);
}
// create a dataset that has view data with overlay info on top
final Dataset dataset =
datasetService.create(new long[] { w, h, 3 }, "Captured view",
new AxisType[] { Axes.X, Axes.Y, Axes.CHANNEL }, 8, false, false);
dataset.setRGBMerged(true);
final RandomAccess<? extends RealType<?>> accessor = dataset.randomAccess();
for (int x = 0; x < w; x++) {
accessor.setPosition(x, 0);
for (int y = 0; y < h; y++) {
accessor.setPosition(y, 1);
final int rgb = outputImage.getRGB(x, y);
final int r = (rgb >> 16) & 0xff;
final int g = (rgb >> 8) & 0xff;
final int b = (rgb >> 0) & 0xff;
accessor.setPosition(0, 2);
accessor.get().setReal(r);
accessor.setPosition(1, 2);
accessor.get().setReal(g);
accessor.setPosition(2, 2);
accessor.get().setReal(b);
}
}
return dataset;
}
示例12: prototype
import net.imagej.display.DatasetView; //導入依賴的package包/類
@Override
public omero.RType prototype(final Class<?> type) {
// image types
if (Dataset.class.isAssignableFrom(type) ||
DatasetView.class.isAssignableFrom(type) ||
ImageDisplay.class.isAssignableFrom(type))
{
// use an image ID
return omero.rtypes.rlong(0);
}
// table
if (Table.class.isAssignableFrom(type) || TableDisplay.class
.isAssignableFrom(type))
{
// table file ID
return omero.rtypes.rlong(0);
}
// primitive types
final Class<?> saneType = ConversionUtils.getNonprimitiveType(type);
if (Boolean.class.isAssignableFrom(saneType)) {
return omero.rtypes.rbool(false);
}
if (Double.class.isAssignableFrom(saneType)) {
return omero.rtypes.rdouble(Double.NaN);
}
if (Float.class.isAssignableFrom(saneType)) {
return omero.rtypes.rfloat(Float.NaN);
}
if (Integer.class.isAssignableFrom(saneType)) {
return omero.rtypes.rint(0);
}
if (Long.class.isAssignableFrom(saneType)) {
return omero.rtypes.rlong(0L);
}
// data structure types
if (type.isArray()) {
return omero.rtypes.rarray();
}
if (List.class.isAssignableFrom(type)) {
return omero.rtypes.rlist();
}
if (Map.class.isAssignableFrom(type)) {
return omero.rtypes.rmap();
}
if (Set.class.isAssignableFrom(type)) {
return omero.rtypes.rset();
}
// default case: convert to string
// works for many types, including but not limited to:
// - char
// - java.io.File
// - java.lang.Character
// - java.lang.String
// - java.math.BigDecimal
// - java.math.BigInteger
// - org.scijava.util.ColorRGB
return omero.rtypes.rstring("");
}
示例13: testGetJobParam
import net.imagej.display.DatasetView; //導入依賴的package包/類
/** Tests {@link OMEROService#getJobParam(org.scijava.module.ModuleItem)}. */
@Test
public void testGetJobParam() {
// -- test primitive types --
assertParam(omeroService, RBool.class, boolean.class);
assertParam(omeroService, RString.class, byte.class);
assertParam(omeroService, RString.class, char.class);
assertParam(omeroService, RDouble.class, double.class);
assertParam(omeroService, RFloat.class, float.class);
assertParam(omeroService, RInt.class, int.class);
assertParam(omeroService, RLong.class, long.class);
assertParam(omeroService, RString.class, short.class);
// -- test primitive object wrappers --
assertParam(omeroService, RBool.class, Boolean.class);
assertParam(omeroService, RString.class, Byte.class);
assertParam(omeroService, RString.class, Character.class);
assertParam(omeroService, RDouble.class, Double.class);
assertParam(omeroService, RFloat.class, Float.class);
assertParam(omeroService, RInt.class, Integer.class);
assertParam(omeroService, RLong.class, Long.class);
assertParam(omeroService, RString.class, Short.class);
// -- test array types --
assertParam(omeroService, RArray.class, boolean[].class);
assertParam(omeroService, RArray.class, byte[].class);
assertParam(omeroService, RArray.class, char[].class);
assertParam(omeroService, RArray.class, double[].class);
assertParam(omeroService, RArray.class, float[].class);
assertParam(omeroService, RArray.class, int[].class);
assertParam(omeroService, RArray.class, long[].class);
assertParam(omeroService, RArray.class, short[].class);
assertParam(omeroService, RArray.class, Object[].class);
assertParam(omeroService, RArray.class, String[].class);
// -- test collection types --
assertParam(omeroService, RList.class, List.class);
assertParam(omeroService, RMap.class, Map.class);
assertParam(omeroService, RSet.class, Set.class);
assertParam(omeroService, RList.class, ArrayList.class);
assertParam(omeroService, RMap.class, HashMap.class);
assertParam(omeroService, RSet.class, HashSet.class);
// -- test ImageJ image types --
assertParam(omeroService, RLong.class, Dataset.class);
assertParam(omeroService, RLong.class, DatasetView.class);
assertParam(omeroService, RLong.class, ImageDisplay.class);
// -- test other object types --
assertParam(omeroService, RString.class, BigDecimal.class);
assertParam(omeroService, RString.class, BigInteger.class);
assertParam(omeroService, RString.class, ColorRGB.class);
assertParam(omeroService, RString.class, File.class);
}
示例14: testPrototype
import net.imagej.display.DatasetView; //導入依賴的package包/類
/** Tests {@link OMEROService#prototype(Class)}. */
@Test
public void testPrototype() {
// -- test primitive types --
assertPrototype(omeroService, RBool.class, boolean.class);
assertPrototype(omeroService, RString.class, byte.class);
assertPrototype(omeroService, RString.class, char.class);
assertPrototype(omeroService, RDouble.class, double.class);
assertPrototype(omeroService, RFloat.class, float.class);
assertPrototype(omeroService, RInt.class, int.class);
assertPrototype(omeroService, RLong.class, long.class);
assertPrototype(omeroService, RString.class, short.class);
// -- test primitive object wrappers --
assertPrototype(omeroService, RBool.class, Boolean.class);
assertPrototype(omeroService, RString.class, Byte.class);
assertPrototype(omeroService, RString.class, Character.class);
assertPrototype(omeroService, RDouble.class, Double.class);
assertPrototype(omeroService, RFloat.class, Float.class);
assertPrototype(omeroService, RInt.class, Integer.class);
assertPrototype(omeroService, RLong.class, Long.class);
assertPrototype(omeroService, RString.class, Short.class);
// -- test array types --
assertPrototype(omeroService, RArray.class, boolean[].class);
assertPrototype(omeroService, RArray.class, byte[].class);
assertPrototype(omeroService, RArray.class, char[].class);
assertPrototype(omeroService, RArray.class, double[].class);
assertPrototype(omeroService, RArray.class, float[].class);
assertPrototype(omeroService, RArray.class, int[].class);
assertPrototype(omeroService, RArray.class, long[].class);
assertPrototype(omeroService, RArray.class, short[].class);
assertPrototype(omeroService, RArray.class, Object[].class);
assertPrototype(omeroService, RArray.class, String[].class);
// -- test collection types --
assertPrototype(omeroService, RList.class, List.class);
assertPrototype(omeroService, RMap.class, Map.class);
assertPrototype(omeroService, RSet.class, Set.class);
assertPrototype(omeroService, RList.class, ArrayList.class);
assertPrototype(omeroService, RMap.class, HashMap.class);
assertPrototype(omeroService, RSet.class, HashSet.class);
// -- test ImageJ image types --
assertPrototype(omeroService, RLong.class, Dataset.class);
assertPrototype(omeroService, RLong.class, DatasetView.class);
assertPrototype(omeroService, RLong.class, ImageDisplay.class);
// -- test other object types --
assertPrototype(omeroService, RString.class, BigDecimal.class);
assertPrototype(omeroService, RString.class, BigInteger.class);
assertPrototype(omeroService, RString.class, ColorRGB.class);
assertPrototype(omeroService, RString.class, File.class);
}