本文整理汇总了Java中net.imglib2.view.Views.dropSingletonDimensions方法的典型用法代码示例。如果您正苦于以下问题:Java Views.dropSingletonDimensions方法的具体用法?Java Views.dropSingletonDimensions怎么用?Java Views.dropSingletonDimensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.view.Views
的用法示例。
在下文中一共展示了Views.dropSingletonDimensions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculate
import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public RandomAccessibleInterval<T> calculate(final RandomAccessibleInterval<T> input, final Interval interval) {
boolean oneSizedDims = false;
if (dropSingleDimensions) {
for (int d = 0; d < interval.numDimensions(); d++) {
if (interval.dimension(d) == 1) {
oneSizedDims = true;
break;
}
}
}
if (Intervals.equals(input, interval) && !oneSizedDims)
return input;
if (!Intervals.contains(input, interval))
throw new RuntimeException("Intervals don't match!");
IntervalView<T> res = Views.offsetInterval(input, interval);
return oneSizedDims ? Views.dropSingletonDimensions(res) : res;
}
示例2: get
import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public RandomAccessibleInterval<T> get() {
localize(tmpPosition);
final long[] offset = tmpPosition.clone();
for (int d = 0; d < max.length; d++) {
offset[d] += sliceOffset[d];
}
final IntervalView<T> res = Views.offsetInterval(src, offset, sliceDims);
return dropSingltonDimensions ? Views.dropSingletonDimensions(res) : res;
}
示例3: preview
import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public void preview(){
// check which parameter changed and update necessary value
if( initInterupted ){
return;
}
if( !wasStateChanged() ){
return;
}
else{
needUpdate=true;
}
if( !readyToFire){
if( needUpdate ){ // wait 200 millisecond and try to preview again
try {
TimeUnit.MILLISECONDS.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
preview();
}
return;
}
readyToFire = false;
// update labelMap slice to visualize
if( changed.get("hMin") || changed.get("thresh") || changed.get("pos") || changed.get("peakFlooding") || changed.get("allowSplitting") || changed.get("displayOrient"))
{
Img<IntType> img_currentSegmentation = segmentTreeLabeler.getLabelMap( getHMin(), getThresh(), peakFlooding, allowSplitting, displayOrient, pos[displayOrient]-1);
RandomAccessibleInterval<IntType> rai_currentSegmentation = Views.dropSingletonDimensions(img_currentSegmentation);
imp_curSeg = ImageJFunctions.wrapFloat(rai_currentSegmentation, "treeCut");
segDispRange[0] = 0;
segDispRange[1] = segmentTreeLabeler.getNLabels();
}
render();
readyToFire = true;
needUpdate = false;
}
示例4: calculate
import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public RandomAccessibleInterval<T> calculate(RandomAccessibleInterval<T> input) {
return Views.dropSingletonDimensions(input);
}
示例5: dropSingletonDimensionsTest
import net.imglib2.view.Views; //导入方法依赖的package包/类
@Test
public void dropSingletonDimensionsTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 1, 10 }, new DoubleType());
RandomAccessibleInterval<DoubleType> il2 = Views.dropSingletonDimensions(img);
RandomAccessibleInterval<DoubleType> opr = ops.transform().dropSingletonDimensionsView(img);
assertEquals(il2.numDimensions(), opr.numDimensions());
}