• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Dataset类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.imagej.Dataset的典型用法代码示例。如果您正苦于以下问题:Java Dataset类的具体用法?Java Dataset怎么用?Java Dataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Dataset类属于net.imagej包,在下文中一共展示了Dataset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: isValidIntensityImage

import net.imagej.Dataset; //导入依赖的package包/类
private boolean isValidIntensityImage(final Dataset dataset) {
	// NB Composite channel count is a hacky way to check if the image is
	// greyscale. It doesn't not correspond with the number of channels in the
	// image
	final int compositeChannelCount = dataset.getCompositeChannelCount();
	if (compositeChannelCount != 1 || dataset.getValidBits() != 8) {
		cancel("The intensity image needs to be 8-bit greyscale");
		return false;
	}
	if (AxisUtils.hasTimeDimensions(dataset)) {
		cancel("The intensity image can't have a time dimension");
		return false;
	}
	if (AxisUtils.hasChannelDimensions(dataset)) {
		cancel("The intensity image can't have a channel dimension");
		return false;
	}
	if (AxisUtils.countSpatialDimensions(dataset) != inputImage
		.getNDimensions())
	{
		cancel(
			"The intensity image should match the dimensionality of the input image");
		return false;
	}
	return true;
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:27,代码来源:AnalyseSkeletonWrapper.java


示例2: convertToGenericTexture

import net.imagej.Dataset; //导入依赖的package包/类
public static GenericTexture convertToGenericTexture( Dataset d ) {
    long width = d.getWidth();
    long height = d.getHeight();

    GLVector dims = new GLVector( width, height, 1 );
    int nChannels = 3;

    ByteBuffer bb = BufferUtils.BufferUtils.allocateByte((int) (width * height * nChannels));

    System.out.println("Size:" + width + " " +  height + " " + nChannels);

    Cursor cur = d.cursor();
    while( cur.hasNext() ) {
        cur.fwd();
        int val = ((UnsignedByteType) cur.get()).get();
        //System.out.println( (byte)val );
        bb.put( (byte) val );
        //bb.put((byte)(Math.random()*255));
    }
    bb.flip();

    return new GenericTexture("neverUsed", dims, nChannels, GLTypeEnum.UnsignedByte, bb, true, true, false);
}
 
开发者ID:scenerygraphics,项目名称:SciView,代码行数:24,代码来源:Main.java


示例3: volumeRenderTest

import net.imagej.Dataset; //导入依赖的package包/类
public static void volumeRenderTest() throws IOException {

//      Volume render test
        SciView sciView = ((SciViewService) ij.getContext().getService( "sc.iview.SciViewService" )).getOrCreateActiveSciView();
        Dataset testImg = (Dataset) ij.io().open(  SciView.class.getResource("/cored_cube_16bit.tif").getFile() );
        System.out.println( testImg.firstElement().getClass() );
        Node v = sciView.addVolume( testImg, new float[]{1,1,1}, ij.log(), ij.op() );
        v.setScale(new GLVector(10f, 10f, 10f));
        sciView.displayNodeProperties( v, ij.log() );

        int isoLevel = 1;
        Img<UnsignedShortType> testImgImg = (Img<UnsignedShortType>) testImg.getImgPlus().getImg();
        Img<BitType> bitImg = (Img<BitType>) ij.op().threshold().apply(  testImgImg,
                new UnsignedShortType( isoLevel ) );

        Mesh m = ij.op().geom().marchingCubes( bitImg, isoLevel, new BitTypeVertexInterpolator());

        DefaultMesh dm = (DefaultMesh) m;

        //sciView.displayNodeProperties( sciView.addMesh( m ) );

    }
 
开发者ID:scenerygraphics,项目名称:SciView,代码行数:23,代码来源:Main.java


示例4: write

import net.imagej.Dataset; //导入依赖的package包/类
public void write(Dataset data, FileLinkElement elementToWrite)
        throws SlideSetException {
    final Context context = data.getContext();
    String path = elementToWrite.getUnderlying();
    path = elementToWrite.getOwner().resolvePath(path);
    final File pathF = new File(path);
    if(!pathF.getParentFile().exists())
        try {
            pathF.getParentFile().mkdirs();
        } catch(Exception ex) {
            throw new LinkNotFoundException(
                    path + " could not be created.", ex);
        }
    try {
        if(pathF.exists())
            pathF.delete(); // This is less than ideal, but there seems to be an ImageJ bug overwriting exisiting images, especially if the new image has different dimensions.
        context.getService(DatasetService.class).save(data, path);
    } catch(Exception e) {
        throw new ImgLinkException(e);
    }
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:22,代码来源:DatasetToImageFileWriter.java


示例5: read

import net.imagej.Dataset; //导入依赖的package包/类
public Dataset read(FileLinkElement elementToRead) throws SlideSetException {
    String path = elementToRead.getUnderlying();
    String wd = elementToRead.getOwner().getWorkingDirectory();
    wd = wd == null ? "" : wd;
    if(!(new File(path)).isAbsolute())
        path = wd + File.separator + path;
    if(!(new File(path).exists()))
       throw new LinkNotFoundException(path + " does not exist!");
    Dataset d;
    DatasetService dss = elementToRead.getOwner()
            .getContext().getService(DatasetService.class);
    try{ d = dss.open(path); }
    catch(Exception e) {
        throw new ImgLinkException(e);
    }
    return d;
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:18,代码来源:ImageFileToDatasetReader.java


示例6: run

import net.imagej.Dataset; //导入依赖的package包/类
public void run() {
    try {
        this.getClass().getClassLoader().loadClass("trainableSegmentation.WekaSegmentation");
    } catch(ClassNotFoundException e) {
        log.println("####################################################");
        log.println("Error: Trainable Weka Segmentation plugin not found.");
        log.println("       If the plugin is not included with Fiji, it");
        log.println("       must be installed seperately.");
        log.println("####################################################");
        throw new IllegalArgumentException();
    }
    if(dit == null)
        dit = new DefaultImageTranslator(ij.get(LegacyService.class));
    WekaSegmentation ws = new WekaSegmentation(dit.createLegacyImage(ds));
    ws.loadClassifier(cfr.getPath());
    ws.applyClassifier(prob);
    ImageDisplay dpOut = dit.createDisplay(ws.getClassifiedImage());
    Data dOut = dpOut.getActiveView().getData();
    out = (Dataset) dOut;
    dpOut.close();
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:22,代码来源:WekaSegmentationWrapper.java


示例7: DatasetFigureView

import net.imagej.Dataset; //导入依赖的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);
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:20,代码来源:DatasetFigureView.java


示例8: open

import net.imagej.Dataset; //导入依赖的package包/类
@Override
public Dataset open(final String source, final SCIFIOConfig config)
	throws IOException
{
	final ImgOpener imageOpener = new ImgOpener(getContext());
	try {
		// TODO openImgs we are only using the first image index in the
		// SCIFIOConfig.imgOpenerGetRange - so this image index corresponds to the
		// first ImgPlus in the list returned by the ImgOpener. See
		// https://github.com/scifio/scifio/issues/259

		final SCIFIOImgPlus<?> imgPlus =
			imageOpener.openImgs(source, config).get(0);

		@SuppressWarnings({ "rawtypes", "unchecked" })
		final Dataset dataset = datasetService.create((ImgPlus) imgPlus);

		final ImageMetadata imageMeta = imgPlus.getImageMetadata();
		updateDataset(dataset, imageMeta);
		return dataset;
	}
	catch (final ImgIOException exc) {
		throw new IOException(exc);
	}
}
 
开发者ID:scifio,项目名称:scifio,代码行数:26,代码来源:DefaultDatasetIOService.java


示例9: openAll

import net.imagej.Dataset; //导入依赖的package包/类
@Override
public List<net.imagej.Dataset> openAll(String source, SCIFIOConfig config)
        throws IOException
{
        final ArrayList<Dataset> datasetList = new ArrayList<>();

        final ImgOpener imageOpener = new ImgOpener(getContext());
        try {
            final List<SCIFIOImgPlus<?>> openImgs = imageOpener.openImgs(source, config);
            for (int imgId = 0; imgId != openImgs.size(); imgId++) {
                
                final SCIFIOImgPlus<?> imgPlus = openImgs.get(imgId);
                
                @SuppressWarnings({"rawtypes", "unchecked"})
                final Dataset dataset = datasetService.create((ImgPlus) imgPlus);

                final ImageMetadata imageMeta = imgPlus.getImageMetadata();
                updateDataset(dataset, imageMeta);
                datasetList.add(dataset);
            }

        } catch (final ImgIOException exc) {
            throw new IOException(exc);
        }
        return datasetList;
}
 
开发者ID:scifio,项目名称:scifio,代码行数:27,代码来源:DefaultDatasetIOService.java


示例10: updateDataset

import net.imagej.Dataset; //导入依赖的package包/类
/**
 * The {@link DatasetService#create} methods make a best guess for populating
 * {@link Dataset} information. But this can be incorrect/over-aggressive,
 * e.g. in the case of RGBMerged state.
 * <p>
 * If we have access to the {@link Metadata} instance backing a
 * {@code Dataset}, we can use it to more accurately populate these settings.
 * </p>
 *
 * @param dataset Dataset instance to update.
 * @param imageMeta Metadata instance to query for updated information.
 */
private void updateDataset(final Dataset dataset,
	final ImageMetadata imageMeta)
{
	// If the original image had some level of merged channels, we should set
	// RGBmerged to true for the sake of backwards compatibility.
	// See https://github.com/imagej/imagej-legacy/issues/104

	// Look for Axes.CHANNEL in the planar axis list. If found, set RGBMerged to
	// true.
	boolean rgbMerged = false;

	for (final CalibratedAxis axis : imageMeta.getAxesPlanar()) {
		if (axis.type().equals(Axes.CHANNEL)) rgbMerged = true;
	}

	dataset.setRGBMerged(rgbMerged);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:30,代码来源:DefaultDatasetIOService.java


示例11: uploadImage

import net.imagej.Dataset; //导入依赖的package包/类
@Override
public long uploadImage(final omero.client client, final Dataset dataset)
	throws omero.ServerError, IOException
{
	// TODO: Reuse existing client instead of creating a new connection.
	// Will need to rethink how SCIFIO conveys source and destination metadata.
	// The RandomAccessInput/OutputStream design is probably too narrow.
	final String omeroDestination =
		"name=" + dataset.getName() + "&" + credentials(client) //
			+ ".omero"; // FIXME: Remove this after SCIFIO doesn't need it anymore.

	final Metadata metadata = datasetIOService.save(dataset, omeroDestination);

	if (metadata instanceof OMEROFormat.Metadata) {
		final OMEROFormat.Metadata omeroMeta = (OMEROFormat.Metadata) metadata;
		return omeroMeta.getImageID();
	}
	return -1;
}
 
开发者ID:imagej,项目名称:imagej-omero,代码行数:20,代码来源:DefaultOMEROService.java


示例12: convert

import net.imagej.Dataset; //导入依赖的package包/类
@Override
public PNGImageNotebookOutput convert(Object object) {

    Dataset source = (Dataset) object;

    String base64Image = (String) ijnb.RAIToPNG((Img) source, //
            source.dimensionIndex(Axes.X),
            source.dimensionIndex(Axes.Y),
            source.dimensionIndex(Axes.CHANNEL),
            ImageJNotebookService.ValueScaling.AUTO);

    return new PNGImageNotebookOutput(base64Image);
}
 
开发者ID:scijava,项目名称:scijava-jupyter-kernel,代码行数:14,代码来源:DatasetToPNGNotebookConverter.java


示例13: read

import net.imagej.Dataset; //导入依赖的package包/类
public ImageDisplay read(
        FileLinkElement elementToRead)
        throws SlideSetException {
    if(itdr == null)
        itdr = new ImageFileToDatasetReader();
    Dataset img = itdr.read(elementToRead);
    return (ImageDisplay) img.getContext()
            .getService(DisplayService.class).createDisplay(img);
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:10,代码来源:ImageFileToImageDisplayReader.java


示例14: loadData

import net.imagej.Dataset; //导入依赖的package包/类
/** Load the internal data */
private void loadData() throws SlideSetException {
     ArrayList<ColumnBoundReader> iCbrs;
     iCbrs = dtid.getCompatableColumnReaders(Dataset.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.");
     }
     if(iCbrs.size() > 1) {
          int choices = iCbrs.size();
          String[] names = new String[choices];
          for(int i=0; i<choices; i++)
               names[i] = String.valueOf(i+1)
                       + ": " + iCbrs.get(i).getColumnName();
          Object choice = JOptionPane.showInputDialog(this,
                  "Select images on which ROIs will be drawn:",
                  "SlideSet - ROI Editor",
                  JOptionPane.PLAIN_MESSAGE,
                  null, names, names[0]);
          if(choice == null)
          { throw new OperationCanceledException("No images selected"); }
          for(int i=0; i<choices; i++) {
               images = iCbrs.get(i);
               if(names[i].equals(choice))
                    break;
          }
     }
     else images = iCbrs.get(0);
     loadOverlays();
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:36,代码来源:RoiEditor.java


示例15: run

import net.imagej.Dataset; //导入依赖的package包/类
public void run() {
    int max = new Double(ds.getType().getMaxValue()).intValue();
    final double logMax = Math.log(max);
    final double[] p1 = parseRGBtoPigment(pigmentOne, max);
    final double[] p2 = parseRGBtoPigment(pigmentTwo, max);
    Dataset[] result;
    try {
        result = unmix(ds, p1, p2);
        if(result == null || result.length != 3)
            throw new SlideSetException("Null or unexpected result!");
    } catch(SlideSetException e) {
        if(log != null) {
            log.println("-------------------------");
            log.println("Error: " + e.getMessage());
            log.println("  " + ds.getName());
            log.println("  will be skipped.");
            log.println("-------------------------");
        }
        p1ds = new Dataset[0];
        p2ds = new Dataset[0];
        rds = new Dataset[0];
        return;
    }
    p1ds = new Dataset[] {result[0]};
    p2ds = new Dataset[] {result[1]};
    rds = new Dataset[] {result[2]};
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:28,代码来源:UnmixAbsorbance.java


示例16: ThresholdFigure

import net.imagej.Dataset; //导入依赖的package包/类
public ThresholdFigure(ImageDisplay display, Dataset dataset,
	ThresholdOverlay overlay)
{
	this.display = display;
	this.dataset = dataset;
	this.overlay = overlay;
	this.rect = new Rectangle2D.Double();
	setAttributeEnabled(AttributeKeys.FILL_COLOR, true);
	setAttributeEnabled(AttributeKeys.STROKE_COLOR, false);
	setAttributeEnabled(AttributeKeys.TEXT_COLOR, false);
	set(AttributeKeys.FILL_COLOR, Color.DARK_GRAY); // always have a color set
	overlay.setFigure(this);
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:14,代码来源:ThresholdFigure.java


示例17: createDefaultFigure

import net.imagej.Dataset; //导入依赖的package包/类
@Override
public Figure createDefaultFigure() {
	ImageDisplay display = imageDisplayService.getActiveImageDisplay();
	if (display == null) return null;
	Dataset dataset = imageDisplayService.getActiveDataset();
	if (dataset == null) return null;
	ThresholdOverlay overlay = thresholdService.getThreshold(display);
	return new ThresholdFigure(display, dataset, overlay);
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:10,代码来源:ThresholdJHotDrawAdapter.java


示例18: create

import net.imagej.Dataset; //导入依赖的package包/类
@Override
public Dataset create(final long[] dims, final String name,
	final AxisType[] axes, final int bitsPerPixel, final boolean signed,
	final boolean floating)
{
	return datasetService().create(dims, name, axes, bitsPerPixel, signed,
		floating);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:9,代码来源:SCIFIODatasetService.java


示例19: revert

import net.imagej.Dataset; //导入依赖的package包/类
@Override
public void revert(final Dataset dataset) throws IOException {
	final String source = dataset.getSource();
	if (source == null || source.isEmpty()) {
		// no way to revert
		throw new IOException("Cannot revert image of unknown origin");
	}
	final Dataset revertedDataset = open(source);
	revertedDataset.copyInto(dataset);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:11,代码来源:DefaultDatasetIOService.java


示例20: toOMERO

import net.imagej.Dataset; //导入依赖的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);
}
 
开发者ID:imagej,项目名称:imagej-omero,代码行数:30,代码来源:DefaultOMEROService.java



注:本文中的net.imagej.Dataset类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InjectionException类代码示例发布时间:2022-05-22
下一篇:
Java SimpleMessageListenerAdapter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap