Skip to content

Commit

Permalink
Support long range affinites
Browse files Browse the repository at this point in the history
The long range affinities are collected based on a hard-coded grid for
now
  • Loading branch information
ranlu committed Sep 11, 2024
1 parent dc988b2 commit d1e3cb9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scripts/cut_chunk_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def write_metadata(fn, offset, size, ac_offset):
ac_offset = param["ac_offset"]
boundary_flags = param["boundary_flags"]

extra_aff_backward = [1, 1, 1]
extra_aff_forward = [0, 0, 0]
extra_aff_backward = [5, 5, 2]
extra_aff_forward = [5, 5, 2]

extra_aff_before = [0, 0, 0]
extra_aff_after = [x + y for x, y in zip(extra_aff_backward, extra_aff_forward)]
Expand Down
16 changes: 13 additions & 3 deletions src/seg/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,22 @@ void traverseSegments(const Ts& seg, Ta& ... extractors)
auto shape = seg.shape();
auto c = Coord({0,0,0});

constexpr auto scan_grid = std::array<std::array<int, 3>, 3> {{
constexpr auto long_range = std::array<int, 3> {5, 5, 2};

constexpr auto scan_grid = std::array<std::array<int, 3>, 12> {{
{-1,0,0}, {0,-1,0}, {0,0,-1},
{-long_range[0],0,0}, {0,-long_range[1],0},
{-long_range[0],-long_range[1],0},
{-long_range[0],long_range[1],0},
{-long_range[0],0,-1},
{0,-long_range[1],-1},
{-long_range[0],0,1},
{0,-long_range[1],1},
{0,0,-long_range[2]},
}};

constexpr std::array<int, 3> aff_backward = {1, 1, 1}
constexpr std::array<int, 3> aff_forward = {0, 0, 0};
constexpr std::array<int, 3> aff_backward = long_range;
constexpr std::array<int, 3> aff_forward = long_range;

int z = skipType == 2 ? base[2]+1: base[2];
for (; z != base[2]+shape[2]; z++) {
Expand Down
5 changes: 3 additions & 2 deletions src/seg/atomic_chunk_ME.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ int main(int argc, char * argv[])
std::cout << "mmap seg data" << std::endl;

bio::mapped_file_source aff_file;
size_t aff_bytes = sizeof(aff_t)*dim[0]*dim[1]*dim[2]*3;
size_t aff_dim = 12;
size_t aff_bytes = sizeof(aff_t)*dim[0]*dim[1]*dim[2]*aff_dim;
aff_file.open("aff.raw", aff_bytes);
assert(aff_file.is_open());
ConstChunkRef<aff_t, 4> aff_chunk (reinterpret_cast<const aff_t*>(aff_file.data()), boost::extents[Range(offset[0], offset[0]+dim[0])][Range(offset[1], offset[1]+dim[1])][Range(offset[2], offset[2]+dim[2])][3], boost::fortran_storage_order());
ConstChunkRef<aff_t, 4> aff_chunk (reinterpret_cast<const aff_t*>(aff_file.data()), boost::extents[Range(offset[0], offset[0]+dim[0])][Range(offset[1], offset[1]+dim[1])][Range(offset[2], offset[2]+dim[2])][aff_dim], boost::fortran_storage_order());
std::cout << "mmap aff data" << std::endl;

auto map = loadChunkMap<seg_t>("chunkmap.data");
Expand Down

0 comments on commit d1e3cb9

Please sign in to comment.