예제 #1
0
파일: Area.cpp 프로젝트: jmeinke/StOAP
CubeArea* CubeArea::expandBase(AggregationMaps *aggregationMaps) const {
  const vector<Dimension*> &dimensions = *cube->getDimensions();
  CubeArea* result = new CubeArea(env, cube, dimensions.size());

  aggregationMaps->resize(dimensions.size());

  if (dimCount() != dimensions.size()) {
    throw ErrorException(
        ErrorException::ERROR_INTERNAL,
        "CubeArea::expandBase area and dimension size differ.");
  }

  auto didit = dimensions.begin();
  for (size_t dim = 0; dim < dimCount(); dim++, ++didit) {
    Dimension* dimension = *didit;

    Set* s = new Set();
    for (ConstElemIter eit = elemBegin(dim); eit != elemEnd(dim); ++eit) {
      IdentifierType eId = *eit;
      Element* element = dimension->lookupElement(eId);
      if (!element) {
        LOG(ERROR) << "CubeArea::expandBase element id: " << *eit
         << " not found in dimension: " << dimension->getName();
        continue;  // possible corrupted journal
      }

      /*
      DLOG(WARNING) << "CubeArea::expandBase element id: " << eId
                    << " added in dimension: " << dimension->getName() ;
      */

      try {
        const WeightedSet* baseE = dimension->getBaseElements(element);
        for (auto baseIt = baseE->begin(); baseIt != baseE->end(); ++baseIt) {
          // it seems there is a bug in Set::insert which adds the same id multiple times.
          // therefore check if the element already exists
          if (s->find(baseIt.first()) == s->end()) {
            s->insert(baseIt.first());
          }
        }
        /*
        DLOG(WARNING) << "CubeArea::expandBase adding " << baseE->size()
                      << " source elements to aggregation map." ;
        */
        aggregationMaps->at(dim).buildBaseToParentMap(eId, baseE);
      } catch (const ErrorException& e) {
        // LOG(ERROR) << "CubeArea::expandBase exception: " << e.getMessage();
      }
    }
    result->insert(dim, s);
    aggregationMaps->at(dim).compactSourceToTarget();
  }
  return result;
}
예제 #2
0
파일: Area.cpp 프로젝트: jmeinke/StOAP
bool Area::intersection(const Area &area) const {
  size_t dims = dimCount();
  vector<Set*> intersectionSets(dims);
  vector<Set*> complementSets(dims);
  vector<Set*>::iterator interIt = intersectionSets.begin();
  vector<Set*>::iterator complIt = complementSets.begin();
  for (size_t dim = 0; dim < dimCount(); ++interIt, ++complIt, dim++) {
    const Set* s1 = getDim(dim);
    const Set* s2 = area.getDim(dim);
    if (!s1->intersection(s2, 0, 0)) {
      return false;
    }
  }
  return true;
}
예제 #3
0
int JNiftiImage::size(int dim) const {
	if (!d->m_image) return 0;
	if (dim>=dimCount()) return 1;
	return d->m_image->dim[dim+1];
}
예제 #4
0
QList<int> JNiftiImage::size() const {
	QList<int> ret;
	for (int i=0; i<dimCount(); i++)
		ret << size(i);
	return ret;
}