本文整理汇总了Java中org.eclipse.january.dataset.IDataset.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java IDataset.getDouble方法的具体用法?Java IDataset.getDouble怎么用?Java IDataset.getDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.january.dataset.IDataset
的用法示例。
在下文中一共展示了IDataset.getDouble方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAxisCustom
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**
* Determine if axis is custom
* @param axis dataset of axis values
* @param length number of axis values
* @return true if it is custom
*/
public static boolean isAxisCustom(IDataset axis, int length) {
if (axis == null)
return false;
final Class<?> clazz = axis.getElementClass();
if (clazz != Integer.class) {
return true;
}
if (axis.getSize() != length)
return true;
length--;
return axis.getDouble(0) != 0 && axis.getDouble(length) != length;
}
示例2: createDataset
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
private Dataset createDataset(IDataset image, int[] point, int[] box) {
int[] coords = createCoords(image, point, box);
double[] subset = new double[box[0] * box[1]];
int count = 0;
for (int ix = coords[0]; ix <= coords[2]; ix++) {
for (int iy = coords[1]; iy <= coords[3]; iy++) {
subset[count] = image.getDouble(ix, iy);
++count;
}
}
return DatasetFactory.createFromObject(subset, box);
}
示例3: getSum
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**
* The summed area table is just the sum of all the pixels above and to the
* left of (x, y)
*
* @param image
* @param x
* @param y
* @return The summed area table is just the sum of all the pixels above and
* to the left of (x, y)
*/
private double getSum(IDataset image, int x, int y) {
double sum = 0d;
for (int ix = 0; ix <= x; ix++) {
for (int iy = 0; iy <= y; iy++) {
sum += image.getDouble(ix, iy);
}
}
return sum;
}
示例4: transform
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
public final static void transform(IDataset label, int index, double[]... points) {
if (label!=null) {
for (double[] ds : points) {
double dataIndex = ds[index];
double floor = Math.floor(dataIndex);
double lo = label.getDouble((int)floor);
double hi = label.getDouble((int)Math.ceil(dataIndex));
double frac = dataIndex-floor;
ds[index] = (1-frac)*lo + frac*hi;
}
}
}
示例5: checkTree
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
private void checkTree(TreeFile loadedTree, double expectedValue) throws Exception {
NXroot root = (NXroot) loadedTree.getGroupNode();
NXentry entry = root.getEntry();
NXdata dataGroup = entry.getData();
DataNode dataNode = dataGroup.getDataNode(NXdata.NX_DATA);
ILazyDataset lazyDataset = dataNode.getDataset();
IDataset slice = lazyDataset.getSlice();
double actualValue = slice.getDouble();
assertEquals(expectedValue, actualValue, 1e-15);
}
示例6: getFirstValue
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
private static double getFirstValue(IDataHolder dh, String item) throws Exception {
Serializable v = dh.getMetadata().getMetaValue(item);
if (v != null) {
return Double.parseDouble((String) v);
}
ILazyDataset l = dh.getLazyDataset(item);
int r = l.getRank();
int[] stop = new int[r];
Arrays.fill(stop, 1);
IDataset d = l.getSlice(null, stop, null);
return d.getDouble(new int[r]);
}
示例7: getAxisValue
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**
*
* @param sliceObject
* @param data
* @param value
* @param monitor
* @return the nexus axis value or the index if no nexus axis can be found.
* @throws Throwable
*/
public static Number getAxisValue(SliceObject sliceObject, IVariableManager varMan, DimsData data, int value, IProgressMonitor monitor) throws Throwable {
IDataset axis = getAxis(sliceObject, varMan, data, monitor);
try {
return axis!=null ? axis.getDouble(value) : value;
} catch (Throwable ne) {
return value;
}
}
示例8: value
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**
* @param datasets input datasets
* @return a list of 1D datasets which are centroids in every dimension
*/
@Override
public List<Double> value(IDataset... datasets) {
if (datasets.length == 0)
return null;
List<Double> result = new ArrayList<Double>();
for (IDataset ds : datasets) {
final int rank = ds.getRank();
final int[] shape = ds.getShape();
if (bases == null || bases.length == 0) {
bases = new Dataset[rank];
for (int i = 0; i < rank; i++) {
final int len = shape[i];
final DoubleDataset axis = DatasetFactory.zeros(DoubleDataset.class, len);
bases[i] = axis;
for (int j = 0; j < len; j++) {
axis.setAbs(j, j + 0.5);
}
}
} else {
checkCompatibility(ds);
}
final PositionIterator iter = new PositionIterator(ds.getShape());
final int[] pos = iter.getPos();
double tsum = 0.0;
final double[] xsum = new double[rank];
while (iter.hasNext()) {
double val = ds.getDouble(pos);
tsum += val;
for (int d = 0; d < rank; d++) {
xsum[d] += bases[d].getElementDoubleAbs(pos[d])*val;
}
}
for (int d = 0; d < rank; d++) {
result.add(xsum[d] / tsum);
}
}
return result;
}