Skip to content

Commit

Permalink
cleanup LRPS interface
Browse files Browse the repository at this point in the history
  • Loading branch information
csparker247 committed Aug 26, 2024
1 parent 4a9f3b8 commit 7314d93
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 27 deletions.
2 changes: 1 addition & 1 deletion cmake/CheckMemMap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ else()
message(STATUS "MemMap support: none")
endif()

set(VC_MEMMAP_SUPPORTED VC_MEMMAP_SUPPORTED CACHE BOOL "Memory mapping is supported on this platform")
set(VC_MEMMAP_SUPPORTED VC_MEMMAP_SUPPORTED BOOL "Memory mapping is supported on this platform")
if(VC_MEMMAP_SUPPORTED)
add_compile_definitions(VC_MEMMAP_SUPPORTED=true)
else()
Expand Down
1 change: 0 additions & 1 deletion segmentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ target_compile_options(vc_segmentation
-Wno-c++11-narrowing
)

include_directories(${GSL_INCLUDE_DIRS})
target_link_libraries(vc_segmentation
PUBLIC
VC::core
Expand Down
45 changes: 23 additions & 22 deletions segmentation/include/vc/segmentation/LocalResliceParticleSim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,75 +52,76 @@ class LocalResliceSegmentation : public ChainSegmentationAlgorithm
}

/** @brief Set the start z-index */
void setStartZIndex(int z) { startIndex_ = z; }
void setStartZIndex(int z);

/** @brief Get the start z-index */
int getStartZIndex() { return startIndex_; }
[[nodiscard]] auto getStartZIndex() const -> int;

/** @brief Set the target z-index */
void setTargetZIndex(int z) { endIndex_ = z; }
void setTargetZIndex(int z);

/** @brief Get the target z-index */
int getTargetZIndex() { return endIndex_; }
[[nodiscard]] auto getTargetZIndex() const -> int;

/** @brief Set the number of curve optimization iterations per step */
void setOptimizationIterations(int n) { numIters_ = n; }
void setOptimizationIterations(int n);

/**
* @brief Set the weight for the Active Contour metric
* @see double ActiveContourInternal()
* @see ActiveContourInternal()
*/
void setAlpha(double a) { alpha_ = a; }
void setAlpha(double a);

/**
* @brief Set the stretch weight factor
* @see double ActiveContourInternal()
* @see ActiveContourInternal()
*/
void setK1(double k) { k1_ = k; }
void setK1(double k);

/**
* @brief Set the curvature weight factor
* @see double ActiveContourInternal()
* @see ActiveContourInternal()
*/
void setK2(double k) { k2_ = k; }
void setK2(double k);

/**
* @brief Set the weight for the Absolute Curvature Sum metric
* @see double AbsCurvatureSum()
* @see AbsCurvatureSum()
*/
void setBeta(double b) { beta_ = b; }
void setBeta(double b);

/**
* @brief Set the weight for the Arc Length metric
* @see double WindowedArcLength()
* @see WindowedArcLength()
*/
void setDelta(double d) { delta_ = d; }
void setDelta(double d);

/**
* @brief Set the estimated thickness of the substrate (in um)
*
* Used to generate the radius of the structure tensor calculation
*/
void setMaterialThickness(double m) { materialThickness_ = m; }
void setMaterialThickness(double m);

/** @brief Set the reslice window size */
void setResliceSize(int s) { resliceSize_ = s; }
void setResliceSize(int s);

/** @brief Set the distance weight factor for candidate positions */
void setDistanceWeightFactor(int f) { peakDistanceWeight_ = f; }
void setDistanceWeightFactor(int f);

/** @brief Set whether to consider previous position as candidate position
/**
* @brief Set whether to consider previous position as candidate position
*/
void setConsiderPrevious(bool b) { considerPrevious_ = b; }
void setConsiderPrevious(bool b);

/** @brief Compute the segmentation */
auto compute() -> PointSet override;

/** Debug: Shows intensity maps in GUI window */
void setVisualize(bool b) { visualize_ = b; }
void setVisualize(bool b);

/** Debug: Dumps reslices and intensity maps to disk */
void setDumpVis(bool b) { dumpVis_ = b; }
void setDumpVis(bool b);

/** @brief Returns the maximum progress value */
[[nodiscard]] auto progressIterations() const -> std::size_t override;
Expand Down
54 changes: 51 additions & 3 deletions segmentation/src/LocalResliceParticleSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,50 @@ auto LocalResliceSegmentation::progressIterations() const -> std::size_t
return static_cast<std::size_t>((endIndex_ - startIndex) / stepSize_);
}

void LocalResliceSegmentation::setStartZIndex(int z) { startIndex_ = z; }

auto LocalResliceSegmentation::getStartZIndex() const -> int
{
return startIndex_;
}

void LocalResliceSegmentation::setTargetZIndex(int z) { endIndex_ = z; }

auto LocalResliceSegmentation::getTargetZIndex() const -> int
{
return endIndex_;
}

void LocalResliceSegmentation::setOptimizationIterations(int n)
{
numIters_ = n;
}

void LocalResliceSegmentation::setAlpha(double a) { alpha_ = a; }

void LocalResliceSegmentation::setK1(double k) { k1_ = k; }

void LocalResliceSegmentation::setK2(double k) { k2_ = k; }

void LocalResliceSegmentation::setBeta(double b) { beta_ = b; }

void LocalResliceSegmentation::setDelta(double d) { delta_ = d; }

void LocalResliceSegmentation::setMaterialThickness(double m)
{
materialThickness_ = m;
}
void LocalResliceSegmentation::setResliceSize(int s) { resliceSize_ = s; }

void LocalResliceSegmentation::setDistanceWeightFactor(int f)
{
peakDistanceWeight_ = f;
}
void LocalResliceSegmentation::setConsiderPrevious(bool b)
{
considerPrevious_ = b;
}

auto LocalResliceSegmentation::compute() -> LocalResliceSegmentation::PointSet
{
// reset progress
Expand Down Expand Up @@ -145,9 +189,11 @@ auto LocalResliceSegmentation::compute() -> LocalResliceSegmentation::PointSet

// Convert maxima to voxel positions
std::deque<Voxel> maximaQueue;
for (auto&& maxima : allMaxima) {
maximaQueue.emplace_back(reslice.sliceToVoxelCoord<double>(
{maxima.first, nextLayerIndex}));
for (const auto& [x, _] : allMaxima) {
auto coord = reslice.sliceToVoxelCoord<double>(
{static_cast<double>(x),
static_cast<double>(nextLayerIndex)});
maximaQueue.push_back(coord);
}
nextPositions.push_back(maximaQueue);
}
Expand Down Expand Up @@ -332,6 +378,8 @@ auto LocalResliceSegmentation::compute() -> LocalResliceSegmentation::PointSet
// 6. Output final mesh
return create_final_pointset_(points);
}
void LocalResliceSegmentation::setVisualize(bool b) { visualize_ = b; }
void LocalResliceSegmentation::setDumpVis(bool b) { dumpVis_ = b; }

auto LocalResliceSegmentation::estimate_normal_at_index_(
const FittedCurve& currentCurve, int index) -> cv::Vec3d
Expand Down

0 comments on commit 7314d93

Please sign in to comment.