MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / intersection

Method intersection

core/Box.cpp:73–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 }
72
73Box Box::intersection(const Box& b) const {
74 if (!intersects(b)) {
75 return Box();
76 }
77 std::vector<unsigned long long> start(_start.size(),0), size(_start.size(),0);
78 for (int i = 0; i < _start.size(); ++i) {
79 start[i] = std::max(_start[i], b.getStart()[i]);
80 unsigned long long end = std::min(_start[i] + _size[i], b.getStart()[i] + b.getSize()[i]);
81 if(end > start[i])
82 size[i] = end - start[i];
83 else
84 size[i] = 0;
85 }
86
87 return Box(start, size);
88}

Callers 1

readDataFromImageMethod · 0.80

Calls 2

sizeMethod · 0.80
getSizeMethod · 0.80

Tested by

no test coverage detected