本文整理汇总了Java中net.imglib2.type.numeric.RealType类的典型用法代码示例。如果您正苦于以下问题:Java RealType类的具体用法?Java RealType怎么用?Java RealType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RealType类属于net.imglib2.type.numeric包,在下文中一共展示了RealType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reorder
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
private static <T extends RealType<T>> RandomAccessibleInterval<T> reorder(
RandomAccessibleInterval<T> image, int[] dimOrder)
{
RandomAccessibleInterval<T> output = image;
// Array which contains for each dimension information on which dimension it is right now
int[] moved = IntStream.range(0, image.numDimensions()).toArray();
// Loop over all dimensions and move it to the right spot
for (int i = 0; i < image.numDimensions(); i++) {
int from = moved[i];
int to = dimOrder[i];
// Move the dimension to the right dimension
output = Views.permute(output, from, to);
// Now we have to update which dimension was moved where
moved[i] = to;
moved = Arrays.stream(moved).map(v -> v == to ? from : v).toArray();
}
return output;
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:23,代码来源:Tensors.java
示例2: LongColumn
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
/**
* Creates columns for a {@link net.imagej.table.Table} that describe the
* positions of the subspaces in a hyperspace
* <p>
* For example, if you've split a {X, Y, Z, C, T} space into {X, Y, Z}, the
* method returns "Channel" and "Time" columns that list the positions of the
* subspaces in C and T.
* </p>
*
* @see Subspace
* @param subspaces the subspaces of a hyperspace.
* @param <T> type of the elements in the spaces.
* @return columns that list the positions of the subspaces.
* @deprecated only used in tests.
*/
@Deprecated
public static <T extends RealType<T> & NativeType<T>> List<LongColumn>
createCoordinateColumns(List<Subspace<T>> subspaces)
{
final List<LongColumn> coordinateColumns = new ArrayList<>();
if (subspaces == null) {
return coordinateColumns;
}
final AxisType[] types = subspaces.get(0).getAxisTypes().toArray(
AxisType[]::new);
final List<long[]> positions = subspaces.stream().map(s -> s.getPosition()
.toArray()).collect(Collectors.toList());
for (int i = 0; i < types.length; i++) {
final AxisType type = types[i];
final LongColumn coordinateColumn = new LongColumn(type.getLabel());
final int index = i;
positions.stream().mapToLong(p -> toConventionalIndex(type, p[index]))
.forEach(coordinateColumn::add);
coordinateColumns.add(coordinateColumn);
}
return coordinateColumns;
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:38,代码来源:ResultUtils.java
示例3: applySplit
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
/**
* Splits a subspace along the given coordinates
* <p>
* For example, if you have a 5D {X, Y, Z, C, T} hyperstack, and give the
* coordinates {{3, 0}, {4, 1}} you'll get a 3D {X, Y, Z} subspace of the
* first channel, and second time frame
* </p>
*
* @param hyperstack an n-dimensional image
* @param splitCoordinates (dimension, position) pairs describing the
* hyperstack split
* @return The subspace interval
*/
private static <T extends RealType<T> & NativeType<T>>
RandomAccessibleInterval<T> applySplit(final ImgPlus<T> hyperstack,
final List<ValuePair<IntType, LongType>> splitCoordinates)
{
final List<ValuePair<IntType, LongType>> workingSplit = createWorkingCopy(
splitCoordinates);
RandomAccessibleInterval<T> slice = hyperstack;
for (int i = 0; i < workingSplit.size(); i++) {
final int dimension = workingSplit.get(i).a.get();
final long position = workingSplit.get(i).b.get();
slice = Views.hyperSlice(slice, dimension, position);
decrementIndices(workingSplit, dimension);
}
return slice;
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:29,代码来源:HyperstackUtils.java
示例4: isColorsBinary
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
/**
* Checks whether the interval contains only two distinct values.
* <p>
* NB a hacky brute force approach.
* </p>
*
* @param interval an iterable interval.
* @param <T> type of the elements in the interval.
* @return true if only two distinct values, false if interval is null, empty
* or has more colors.
*/
public static <T extends RealType<T> & NativeType<T>> boolean isColorsBinary(
final IterableInterval<T> interval)
{
if (interval == null || interval.size() == 0) {
return false;
}
if (BooleanType.class.isAssignableFrom(interval.firstElement()
.getClass()))
{
// by definition the elements can only be 0 or 1 so must be binary
return true;
}
final long colours = Streamers.realDoubleStream(interval).distinct()
.count();
return colours <= 2;
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:31,代码来源:ElementUtil.java
示例5: gradient
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
/**
* Compute the partial derivative of source in a particular dimension.
*
* @param source
* source image, has to provide valid data in the interval of the
* gradient image plus a one pixel border in dimension.
* @param target
* output image, the partial derivative of source in the
* specified dimension.
* @param dimension
* along which dimension the partial derivatives are computed
* @param <T> pixel type source
* @param <S> pixel type target
*/
public static < T extends RealType< T >, S extends RealType< S > > void gradient(
final RandomAccessible< T > source,
final RandomAccessibleInterval< S > target,
final int dimension )
{
final Cursor< T > front = Views.flatIterable(
Views.interval( source,
Intervals.translate( target, 1, dimension ) ) ).cursor();
final Cursor< T > back = Views.flatIterable(
Views.interval( source,
Intervals.translate( target, -1, dimension ) ) ).cursor();
for( final S t : Views.flatIterable( target ) )
{
t.setReal( front.next().getRealDouble() - back.next().getRealDouble());
t.mul( 0.5 );
}
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:32,代码来源:Align.java
示例6: pickSpecific
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
public <T extends RealType<T>> RandomAccessibleInterval< T > pickSpecific(List<BasicViewDescription< ? >> vds,
List<RandomAccessibleInterval< T >> rais)
{
for (int i = 0; i< vds.size(); i++)
{
if (entityClass == TimePoint.class)
{
if (vds.get( i ).getTimePoint() == instance)
if (vds.get( i ).isPresent())
return rais.get( i );
continue;
}
if (vds.get( i ).getViewSetup().getAttribute( entityClass ).equals( instance ))
if (vds.get( i ).isPresent())
return rais.get( i );
}
// this should only be reached if the requested view is not present
return null;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:23,代码来源:GroupedViewAggregator.java
示例7: aggregate
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
public <T extends RealType<T>> RandomAccessibleInterval< T > aggregate(
List<RandomAccessibleInterval< T >> rais,
List<? extends ViewId> vids,
AbstractSequenceDescription< ?, ? extends BasicViewDescription< ? >, ? > sd
)
{
Map<BasicViewDescription< ? >, RandomAccessibleInterval<T>> map = new HashMap<>();
for (int i = 0; i < vids.size(); i++)
{
ViewId vid = vids.get( i );
BasicViewDescription< ? > vd = sd.getViewDescriptions().get( vid );
map.put( vd, rais.get( i ) );
}
for (Action< ? > action : actions)
{
map = action.aggregate( map );
}
// return the first RAI still present
// ideally, there should be only one left
return map.values().iterator().next();
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:26,代码来源:GroupedViewAggregator.java
示例8: getMean
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
public <T extends RealType<T>> T getMean(IterableInterval< T > img)
{
RealSum sum = new RealSum();
long nPix = 0;
for (T t : img)
{
sum.add( t.getRealDouble() );
nPix++;
}
T res = img.firstElement().createVariable();
res.setReal( sum.getSum()/nPix );
return res;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:17,代码来源:BrightestViewSelection.java
示例9: calculatePCM
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
public static <T extends RealType<T>, S extends RealType<S>, R extends RealType<R>, C extends ComplexType<C>> RandomAccessibleInterval<R> calculatePCM(
RandomAccessibleInterval<T> img1, RandomAccessibleInterval<S> img2, int[] extension,
ImgFactory<R> factory, R type, ImgFactory<C> fftFactory, C fftType, ExecutorService service){
// TODO: Extension absolute per dimension in pixels, i.e. int[] extension
// TODO: not bigger than the image dimension because the second mirroring is identical to the image
Dimensions extSize = PhaseCorrelation2Util.getExtendedSize(img1, img2, extension);
long[] paddedDimensions = new long[extSize.numDimensions()];
long[] fftSize = new long[extSize.numDimensions()];
FFTMethods.dimensionsRealToComplexFast(extSize, paddedDimensions, fftSize);
RandomAccessibleInterval<C> fft1 = fftFactory.create(fftSize, fftType);
RandomAccessibleInterval<C> fft2 = fftFactory.create(fftSize, fftType);
FFT.realToComplex(Views.interval(PhaseCorrelation2Util.extendImageByFactor(img1, extension),
FFTMethods.paddingIntervalCentered(img1, new FinalInterval(paddedDimensions))), fft1, service);
FFT.realToComplex(Views.interval(PhaseCorrelation2Util.extendImageByFactor(img2, extension),
FFTMethods.paddingIntervalCentered(img2, new FinalInterval(paddedDimensions))), fft2, service);
RandomAccessibleInterval<R> pcm = calculatePCMInPlace(fft1, fft2, factory, type, service);
return pcm;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:26,代码来源:PhaseCorrelation2.java
示例10: getShift
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
/**
* calculate the shift between two images from the phase correlation matrix
* @param pcm the phase correlation matrix of img1 and img2
* @param img1 source image 1
* @param img2 source image 2
* @param nHighestPeaks the number of peaks in pcm to check via cross. corr.
* @param minOverlap minimal overlap (in pixels)
* @param subpixelAccuracy whether to do subpixel shift peak localization or not
* @param interpolateSubpixel whether to interpolate the subpixel shift in cross. corr.
* @param service thread pool
* @return best (highest c.c.) shift peak
*/
public static <T extends RealType<T>, S extends RealType<S>, R extends RealType<R>> PhaseCorrelationPeak2 getShift(
RandomAccessibleInterval<R> pcm, RandomAccessibleInterval<T> img1, RandomAccessibleInterval<S> img2, int nHighestPeaks,
long minOverlap, boolean subpixelAccuracy, boolean interpolateSubpixel, ExecutorService service)
{
System.out.println( "PCM" );
List<PhaseCorrelationPeak2> peaks = PhaseCorrelation2Util.getPCMMaxima(pcm, service, nHighestPeaks, subpixelAccuracy);
//peaks = PhaseCorrelation2Util.getHighestPCMMaxima(peaks, nHighestPeaks);
System.out.println( "expand" );
PhaseCorrelation2Util.expandPeakListToPossibleShifts(peaks, pcm, img1, img2);
System.out.print( "cross " );
long t = System.currentTimeMillis();
PhaseCorrelation2Util.calculateCrossCorrParallel(peaks, img1, img2, minOverlap, service, interpolateSubpixel);
System.out.println( (System.currentTimeMillis() - t) );
System.out.println( "sort" );
Collections.sort(peaks, Collections.reverseOrder(new PhaseCorrelationPeak2.ComparatorByCrossCorrelation()));
System.out.println( "done" );
if (peaks.size() > 0)
return peaks.get(0);
else
return null;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:35,代码来源:PhaseCorrelation2.java
示例11: act
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
@Override
public < T extends RealType< T > > void act(
final int iteration,
final RandomAccessibleInterval< T > matrix,
final RandomAccessibleInterval< T > scaledMatrix,
final double[] lut,
final int[] permutation,
final int[] inversePermutation,
final double[] scalingFactors,
final RandomAccessibleInterval< double[] > estimatedFit )
{
try
{
final String path = fileDir( iteration );
createParentDirectory( path );
write( new IndexedIterable<>( separator, new DoubleArrayIterable( lut ) ), path );
}
catch ( final IOException e )
{
// catch exceptions?
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:26,代码来源:LUTVisitor.java
示例12: calculatePearsons
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
/**
* Calculates Pearson's R value without any constraint in values, thus it uses no
* thresholds. A mask is required to mark which data points should be visited. If
* additional data like the images mean is needed, it is calculated.
*
* @param <S> The images base type.
* @param img1 The first image to walk over.
* @param img2 The second image to walk over.
* @param mask A mask for the images.
* @return Pearson's R value.
* @throws MissingPreconditionException
*/
public <S extends RealType<S>> double calculatePearsons(
RandomAccessibleInterval<S> img1, RandomAccessibleInterval<S> img2,
RandomAccessibleInterval<BitType> mask) throws MissingPreconditionException {
TwinCursor<S> cursor = new TwinCursor<S>(
img1.randomAccess(), img2.randomAccess(),
Views.iterable(mask).localizingCursor());
double r;
if (theImplementation == Implementation.Classic) {
/* since we need the means and apparently don't have them,
* calculate them.
*/
double mean1 = ImageStatistics.getImageMean(img1);
double mean2 = ImageStatistics.getImageMean(img2);
// do the actual calculation
r = classicPearsons(cursor, mean1, mean2);
} else {
r = fastPearsons(cursor);
}
return r;
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:35,代码来源:PearsonsCorrelation.java
示例13: richardsonLucyTV
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
@OpMethod(op = net.imagej.ops.deconvolve.RichardsonLucyTVF.class)
public <
I extends RealType<I>, O extends RealType<O>, K extends RealType<K>, C extends ComplexType<C>>
RandomAccessibleInterval<O> richardsonLucyTV(
final RandomAccessibleInterval<I> in,
final RandomAccessibleInterval<K> kernel, final long[] borderSize,
final OutOfBoundsFactory<I, RandomAccessibleInterval<I>> obfInput,
final OutOfBoundsFactory<K, RandomAccessibleInterval<K>> obfKernel,
final Type<O> outType, final C fftType, final int maxIterations,
final boolean nonCirculant, final boolean accelerate,
final float regularizationFactor)
{
@SuppressWarnings("unchecked")
final RandomAccessibleInterval<O> result =
(RandomAccessibleInterval<O>) ops().run(
net.imagej.ops.deconvolve.RichardsonLucyTVF.class, in, kernel,
borderSize, obfInput, obfKernel, outType, fftType, maxIterations,
nonCirculant, accelerate, regularizationFactor);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:DeconvolveNamespace.java
示例14: main
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
public static final <T extends RealType<T> & NativeType<T>> void main(
final String[] args)
{
final String[] urls = {
"http://loci.wisc.edu/files/software/ome-tiff/z-series.zip"
};
final JFrame frame = new JFrame("ImgPanel Test Frame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final ImgPanel imgPanel = new ImgPanel();
for (final String url : urls) {
final ImgPlus<T> img = loadImage(url);
imgPanel.addImage(url, img);
}
frame.setContentPane(imgPanel);
frame.pack();
center(frame);
frame.setVisible(true);
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:19,代码来源:ImgPanel.java
示例15: adjustDisplayedImage
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
protected void adjustDisplayedImage(RandomAccessibleInterval<? extends RealType<?>> img) {
/*
* when changing the result image to display need to set the image we
* were looking at back to not log scale, so we don't log it twice if
* its reselected.
*/
if (log.isSelected())
toggleLogarithmic(false);
currentlyDisplayedImageResult = img;
pixelAccessCursor = img.randomAccess();
// Currently disabled, due to lag of non-histograms :-)
// disable list and copy button if it is no histogram result
listButton.setEnabled(isHistogram(img));
copyButton.setEnabled(isHistogram(img));
drawImage(img);
toggleLogarithmic(log.isSelected());
// ensure a valid layout, we changed the image
getContentPane().validate();
getContentPane().repaint();
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:25,代码来源:SingleWindowDisplay.java
示例16: preSmooth
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
protected < T extends RealType< T > > void preSmooth( final RandomAccessibleInterval< T > img )
{
if ( additionalSigmaX > 0.0 || additionalSigmaY > 0.0 || additionalSigmaZ > 0.0 )
{
IOFunctions.println( "presmoothing image with sigma=[" + additionalSigmaX + "," + additionalSigmaY + "," + additionalSigmaZ + "]" );
try
{
Gauss3.gauss( new double[]{ additionalSigmaX, additionalSigmaY, additionalSigmaZ }, Views.extendMirrorSingle( img ), img );
}
catch (IncompatibleTypeException e)
{
IOFunctions.println( "presmoothing failed: " + e );
e.printStackTrace();
}
}
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:17,代码来源:DifferenceOf.java
示例17: ops
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
@OpMethod(
op = net.imagej.ops.deconvolve.NonCirculantNormalizationFactor.class)
public <O extends RealType<O>> RandomAccessibleInterval<O>
normalizationFactor(final RandomAccessibleInterval<O> arg,
final Dimensions k, final Dimensions l,
final RandomAccessibleInterval<O> fftInput,
final RandomAccessibleInterval<O> fftKernel,
final Interval imgConvolutionInterval)
{
@SuppressWarnings("unchecked")
final RandomAccessibleInterval<O> result =
(RandomAccessibleInterval<O>) ops().run(
net.imagej.ops.deconvolve.NonCirculantNormalizationFactor.class, arg, k,
l, fftInput, fftKernel, imgConvolutionInterval);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:DeconvolveNamespace.java
示例18: richardsonLucy
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
@OpMethod(op = net.imagej.ops.deconvolve.RichardsonLucyF.class)
public <I extends RealType<I>, O extends RealType<O>, K extends RealType<K>>
RandomAccessibleInterval<O> richardsonLucy(
final RandomAccessibleInterval<I> in,
final RandomAccessibleInterval<K> kernel, final long[] borderSize,
final OutOfBoundsFactory<I, RandomAccessibleInterval<I>> obfInput,
final OutOfBoundsFactory<K, RandomAccessibleInterval<K>> obfKernel,
final int maxIterations)
{
@SuppressWarnings("unchecked")
final RandomAccessibleInterval<O> result =
(RandomAccessibleInterval<O>) ops().run(
net.imagej.ops.deconvolve.RichardsonLucyF.class, in, kernel, borderSize,
obfInput, obfKernel, maxIterations);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:DeconvolveNamespace.java
示例19: createRectengularMaskImage
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
/**
* Creates a mask image with a black background and a white
* rectangular foreground.
*
* @param width The width of the result image.
* @param height The height of the result image.
* @param offset The offset of the rectangular mask.
* @param size The size of the rectangular mask.
* @return A black image with a white rectangle on it.
*/
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> createRectengularMaskImage(
long width, long height, long[] offset, long[] size) {
/* For now (probably until ImageJ2 is out) we use an
* ImageJ image to draw lines.
*/
int options = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY;
ImagePlus img = NewImage.createByteImage("Noise", (int)width, (int)height, 1, options);
ImageProcessor imp = img.getProcessor();
imp.setColor(Color.WHITE);
Roi rect = new Roi(offset[0], offset[1], size[0], size[1]);
imp.fill(rect);
// we changed the data, so update it
img.updateImage();
return ImagePlusAdapter.wrap(img);
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:28,代码来源:TestImageAccessor.java
示例20: main
import net.imglib2.type.numeric.RealType; //导入依赖的package包/类
public static <T extends RealType<T>> void main(final String... args) throws Exception {
// Launch ImageJ as usual.
final ImageJ ij = new ImageJ();
ij.ui().showUI();//launch(args);
// Launch the command .
IJ.openImage("F:\\projects\\2DEmbryoSection_Mette.tif").show();
//Dataset dataset = (Dataset) ij.io().open("F:\\projects\\2DEmbryoSection_Mette.tif");
//Dataset dataset2 = (Dataset) ij.io().open("F:\\projects\\2D_8peaks.tif");
//ij.ui().show(dataset);
ij.command().run(HWatershed_Plugin.class, true);
}
开发者ID:mpicbg-scicomp,项目名称:Interactive-H-Watershed,代码行数:16,代码来源:HWatershed_Plugin.java
注:本文中的net.imglib2.type.numeric.RealType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论