@Override
  public StringDatasetBase getSlice(final SliceIterator siter) {
    StringDatasetBase result = new StringDatasetBase(siter.getShape());
    String[] rdata = result.data; // PRIM_TYPE

    for (int i = 0; siter.hasNext(); i++) rdata[i] = data[siter.index];

    result.setName(
        name
            + BLOCK_OPEN
            + Slice.createString(siter.shape, siter.start, siter.stop, siter.step)
            + BLOCK_CLOSE);
    return result;
  }
示例#2
0
  private void updateSliceWidget(String path) {
    try {
      IDataHolder dh = ServiceHolder.getLoaderService().getData(path, new IMonitor.Stub());
      ILazyDataset lazy = dh.getLazyDataset(fileManager.getContext().getDatasetNames().get(0));
      int[] shape = lazy.getShape();

      int[] dd = Slicer.getDataDimensions(shape, fileManager.getContext().getSliceDimensions());
      Slice[] slices =
          Slicer.getSliceArrayFromSliceDimensions(
              fileManager.getContext().getSliceDimensions(), shape);
      csw.setDatasetShapeInformation(shape, dd.clone(), slices);
      String ss = Slice.createString(csw.getCurrentSlice());
      currentSliceLabel.setText("Current slice of data: [" + ss + "]");
      currentSliceLabel.getParent().layout(true);
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
  }