Java Code Examples for net.imglib2.Interval#dimensions()

The following examples show how to use net.imglib2.Interval#dimensions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlicesII.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private static Interval initIntervals(final Interval src, final int[] axesOfInterest) {

		final long[] dimensionsToIterate = new long[src.numDimensions()];
		src.dimensions(dimensionsToIterate);

		// determine axis to iterate
		for (int i = 0; i < src.numDimensions(); i++) {
			for (int j = 0; j < axesOfInterest.length; j++) {

				if (axesOfInterest[j] == i) {
					dimensionsToIterate[i] = 1;
					break;
				}
			}
		}

		return new FinalInterval(dimensionsToIterate);
	}
 
Example 2
Source File: SlicesII.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public SlicesIICursor(final RandomAccessibleInterval<T> src, final Interval fixedAxes, final Interval slice) {
	super(fixedAxes);

	this.src = src;
	this.tmpPosition = new long[fixedAxes.numDimensions()];
	this.sliceDims = new long[slice.numDimensions()];
	this.sliceOffset = new long[slice.numDimensions()];

	slice.dimensions(sliceDims);
	slice.min(sliceOffset);
}
 
Example 3
Source File: DisplayOverlapTestPopup.java    From BigStitcher with GNU General Public License v2.0 4 votes vote down vote up
public static <S extends AbstractSequenceDescription< ?,? extends BasicViewDescription<? extends BasicViewSetup>, ?  >>
	List<RandomAccessibleInterval< FloatType >> openVirtuallyFused(
			S sd,
			ViewRegistrations vrs,
			Collection<? extends Collection<ViewId>> views,
			Interval boundingBox,
			double[] downsamplingFactors)
{
	final BasicImgLoader imgLoader = sd.getImgLoader();
	
	final List<RandomAccessibleInterval< FloatType >> openImgs = new ArrayList<>();
	final Interval bbSc = TransformVirtual.scaleBoundingBox( new FinalInterval( boundingBox ), inverse( downsamplingFactors ));
	
	final long[] dim = new long[ bbSc.numDimensions() ];
	bbSc.dimensions( dim );
	
	
	for (Collection<ViewId> viewGroup : views)
	{
		final ArrayList< RandomAccessibleInterval< FloatType > > images = new ArrayList<>();
		final ArrayList< RandomAccessibleInterval< FloatType > > weights = new ArrayList<>();
		
		for ( final ViewId viewId : viewGroup )
		{
			final ViewRegistration vr = vrs.getViewRegistration( viewId );
			vr.updateModel();
			AffineTransform3D model = vr.getModel();

			final float[] blending = Util.getArrayFromValue( FusionTools.defaultBlendingRange, 3 );
			final float[] border = Util.getArrayFromValue( FusionTools.defaultBlendingBorder, 3 );

			model = model.copy();
			TransformVirtual.scaleTransform( model, inverse(downsamplingFactors) );

			final RandomAccessibleInterval inputImg = DownsampleTools.openDownsampled( imgLoader, viewId, model );

			System.out.println( model.inverse() );

			FusionTools.adjustBlending( sd.getViewDescriptions().get( viewId ), blending, border, model );

			images.add( TransformView.transformView( inputImg, model, bbSc, 0, 1 ) );
			weights.add( TransformWeight.transformBlending( inputImg, border, blending, model, bbSc ) );
		}
		
		openImgs.add( new FusedRandomAccessibleInterval( new FinalInterval( dim ), images, weights ) );
		
	}		
	
	return openImgs;
	
}