本文整理汇总了Java中net.imglib2.RealInterval.numDimensions方法的典型用法代码示例。如果您正苦于以下问题:Java RealInterval.numDimensions方法的具体用法?Java RealInterval.numDimensions怎么用?Java RealInterval.numDimensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.RealInterval
的用法示例。
在下文中一共展示了RealInterval.numDimensions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyTranslation
import net.imglib2.RealInterval; //导入方法依赖的package包/类
public static FinalRealInterval applyTranslation(RealInterval img, TranslationGet translation, boolean[] ignoreDims){
// get number of dimensions we actually use
int n = 0;
for (int d = 0; d < ignoreDims.length; ++d)
if (!ignoreDims[d])
n++;
final double [] min = new double [n];
final double [] max = new double [n];
int i2 = 0;
for (int i = 0; i< img.numDimensions();++i)
{
if (!ignoreDims[i])
{
min[i2] = img.realMin(i) + translation.getTranslation(i);
max[i2] = img.realMax(i) + translation.getTranslation(i);
i2++;
}
}
return new FinalRealInterval(min, max);
}
示例2: getLocalRasterOverlap
import net.imglib2.RealInterval; //导入方法依赖的package包/类
/**
* create an integer interval from real interval, being conservatie on the size
* (min is ceiled, max is floored)
* @param overlap real input
* @return interger interval, with mins ceiled and maxs floored
*/
public static FinalInterval getLocalRasterOverlap(RealInterval overlap)
{
final int n = overlap.numDimensions();
final long [] min = new long [n];
final long [] max = new long [n];
for (int i = 0; i< n; i++)
{
// round down errors when it is exactly 0.5, if we do not do this we end up with two intervals
// of different size, e.g.:
// if the first interval starts at 139.5 going to 199, the second one at 0.0 going to 59.5
// then the rastered 1st would go from round(139.5)=140 + 1 = 141 -to- round(199)=199 - 1 = 198, dim=58
// and the rastered 2nd would go from round(0.0)=0 + 1 = 1 -to- round(59.5)=60 - 1 = 59, dim=59
min[i] = Math.round((overlap.realMin(i) - 0.0001 )) + 1;
max[i] = Math.round((overlap.realMax(i) + 0.0001 )) - 1;
}
return new FinalInterval(min, max);
}
示例3: getOverlap
import net.imglib2.RealInterval; //导入方法依赖的package包/类
public static FinalRealInterval getOverlap(final RealInterval img1, final RealInterval img2){
final int n = img1.numDimensions();
final double [] min = new double [n];
final double [] max = new double [n];
for (int i = 0; i< n; i++)
{
min[i] = Math.max(img1.realMin(i), img2.realMin(i));
max[i] = Math.min(img1.realMax(i), img2.realMax(i));
// intervals do not overlap
if ( max[i] < min [i])
return null;
}
return new FinalRealInterval(min, max);
}
示例4: getLocalOverlap
import net.imglib2.RealInterval; //导入方法依赖的package包/类
/**
* get overlap in local image coordinates (assuming min = (0,0,..))
* @param img image interval (global coordinates)
* @param overlap overlap interval (global coordinates)
* @return overlap interval in local coordinates
*/
public static FinalRealInterval getLocalOverlap(RealInterval img, RealInterval overlap){
final int n = img.numDimensions();
final double [] min = new double [n];
final double [] max = new double [n];
for (int i = 0; i< n; i++)
{
min[i] = Math.max(0, overlap.realMin(i) - img.realMin(i)) ;
max[i] = Math.max(0, overlap.realMax(i) - img.realMin(i));
}
return new FinalRealInterval(min, max);
}
示例5: Dimensions
import net.imglib2.RealInterval; //导入方法依赖的package包/类
/**
* Extract the dimensions of {@param img} multiplied by the {@param factor}.
* @param img The interval to extract the dimensions of.
* @param factor The factor to multiply the dimensions.
*/
@SuppressWarnings("boxing")
public Dimensions(final RealInterval img, final Number factor) {
for (int i=0; i<img.numDimensions(); ++i) {
add((long)((img.realMax(i) - img.realMin(i) + 1) * factor.doubleValue()));
}
}
示例6: printRealInterval
import net.imglib2.RealInterval; //导入方法依赖的package包/类
public static String printRealInterval( final RealInterval interval )
{
String out = "(Interval empty)";
if ( interval == null || interval.numDimensions() == 0 )
return out;
out = "[" + interval.realMin( 0 );
for ( int i = 1; i < interval.numDimensions(); i++ )
out += ", " + interval.realMin( i );
out += "] -> [" + interval.realMax( 0 );
for ( int i = 1; i < interval.numDimensions(); i++ )
out += ", " + interval.realMax( i );
out += "]";
return out;
}
示例7: intervalDimensions
import net.imglib2.RealInterval; //导入方法依赖的package包/类
static public final long[] intervalDimensions(final RealInterval iri) {
final long[] dim = new long[iri.numDimensions()];
for (int d=0; d<dim.length; ++d)
dim[d] = (long) (iri.realMax(d) - iri.realMin(d) + 1);
return dim;
}