Skip to content

Commit

Permalink
Merge branch 'develop' into pr/spacegaier/3
Browse files Browse the repository at this point in the history
  • Loading branch information
spacegaier committed May 8, 2024
2 parents 0e9c349 + 6dbd9be commit 65aa13d
Show file tree
Hide file tree
Showing 52 changed files with 7,238 additions and 1,913 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches: ["develop"]
tags: ["v*"]
workflow_dispatch:

concurrency: docker

Expand All @@ -15,7 +16,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/educelab/volume-cartographer
images: ghcr.io/spacegaier/volume-cartographer
tags: |
type=ref,event=pr
type=semver,pattern={{version}}
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ docs/html/
cmake-build*/

# VS Code
.vscode/
.vscode/

# personal
*.txt
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,10 @@ endif()
# Setup the config files #
include(VCPackageConfig)
# Install to system directories
include(VCInstall)
include(VCInstall)

# Look for the SDL2 package for Audio
find_package(SDL2 REQUIRED)

# Look for the GNU Scientific Library (GSL) package for interpolation related functionalities
find_package(GSL REQUIRED)
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM ghcr.io/educelab/ci-docker:dynamic.12.0
MAINTAINER Seth Parker <[email protected]>

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y libsdl2-dev libgsl-dev

# Install volcart
COPY ./ /volume-cartographer/
RUN export CMAKE_PREFIX_PATH="/usr/local/Qt-6.6.1/" \
Expand All @@ -10,6 +13,7 @@ RUN export CMAKE_PREFIX_PATH="/usr/local/Qt-6.6.1/" \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_RPATH=/usr/local/Qt-6.6.1/lib \
-DSDL2_DIR=/usr/lib/x86_64-linux-gnu/ \
-DVC_BUILD_ACVD=ON \
&& cmake --build /volume-cartographer/build/ \
&& cmake --install /volume-cartographer/build/ \
Expand Down
352 changes: 69 additions & 283 deletions README.md

Large diffs are not rendered by default.

30 changes: 24 additions & 6 deletions apps/VC/CBSpline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,36 @@ void CBSpline::UpdateCurve(void)
}
}

// Draw the curve on image
void CBSpline::DrawOnImage(cv::Mat& nImg, const cv::Scalar& nColor)
// // Draw the curve on image
// void CBSpline::DrawOnImage(cv::Mat& nImg, const cv::Scalar& nColor)
// {
// // Handle drawing curves with only 2 points
// if (fControlPoints.size() == 2) {
// cv::Point2d start(fControlPoints[0][0], fControlPoints[0][1]);
// cv::Point2d end(fControlPoints[1][0], fControlPoints[1][1]);
// cv::line(nImg, start, end, nColor);
// return;
// }

// for (std::size_t i = 0; i < fCurveSegments.size(); ++i) {
// fCurveSegments[i].DrawOnImage(nImg, nColor);
// }
// }

// Draw the curve on the QGraphicsScene
void CBSpline::DrawOnImage(QGraphicsScene* scene, const QColor& color)
{
QPen pen(color);

// Handle drawing curves with only 2 points
if (fControlPoints.size() == 2) {
cv::Point2d start(fControlPoints[0][0], fControlPoints[0][1]);
cv::Point2d end(fControlPoints[1][0], fControlPoints[1][1]);
cv::line(nImg, start, end, nColor);
auto start = QPointF(fControlPoints[0][0], fControlPoints[0][1]);
auto end = QPointF(fControlPoints[1][0], fControlPoints[1][1]);
scene->addLine(QLineF(start, end), pen);
return;
}

for (std::size_t i = 0; i < fCurveSegments.size(); ++i) {
fCurveSegments[i].DrawOnImage(nImg, nColor);
fCurveSegments[i].DrawOnImage(scene, color);
}
}
7 changes: 5 additions & 2 deletions apps/VC/CBSpline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#include "CBezierCurve.hpp"
#include "MathUtils.hpp"
#include <QGraphicsEllipseItem>
#include <QGraphicsView>
#include <QGraphicsScene>

namespace ChaoVis
{
Expand All @@ -34,8 +37,8 @@ class CBSpline
void GetSamplePoints(std::vector<Vec2<double>>& nSamplePoints);
void GetSamplePoints(std::vector<cv::Vec2f>& nSamplePoints);

void DrawOnImage(
cv::Mat& nImg, const cv::Scalar& nColor = cv::Scalar(0, 0, 255));
void DrawOnImage(QGraphicsScene* scene, const QColor& color = QColor(255, 0, 0));


void Clear()
{
Expand Down
98 changes: 54 additions & 44 deletions apps/VC/CBezierCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,25 +148,34 @@ void CBezierCurve::GetSamplePoints(std::vector<cv::Vec2f>& nSamplePoints)
}
}

// Draw curve on image
void CBezierCurve::DrawOnImage(cv::Mat& nImg, const cv::Scalar& nColor)
// Draw curve on the QGraphicsScene
void CBezierCurve::DrawOnImage(QGraphicsScene* scene, const QColor& color)
{
// circle( nImg, cv::Point2f( 1000, 500 ), 55, cv::Scalar( 0, 0, 255 ) );
// REVISIT - FILL ME HERE
QPen pen(color);
pen.setStyle(Qt::DashLine);

// Debug colors
QColor debugColor1(0, 0, 255); // Blue
QColor debugColor2(0, 255, 0); // Green
QColor debugColor3(255, 0, 0); // Red

#ifdef _DEBUG
cv::line(
nImg, cv::Point2f(fControlPoints[0][0], fControlPoints[0][1]),
cv::Point2f(fControlPoints[1][0], fControlPoints[1][1]),
cv::Scalar(0, 0, 255), 3);
cv::line(
nImg, cv::Point2f(fControlPoints[1][0], fControlPoints[1][1]),
cv::Point2f(fControlPoints[2][0], fControlPoints[2][1]),
cv::Scalar(0, 255, 0), 2);
cv::line(
nImg, cv::Point2f(fControlPoints[2][0], fControlPoints[2][1]),
cv::Point2f(fControlPoints[3][0], fControlPoints[3][1]),
cv::Scalar(255, 0, 0), 1);
#endif // _DEBUG
// Debug control lines
scene->addLine(QLineF(fControlPoints[0][0], fControlPoints[0][1],
fControlPoints[1][0], fControlPoints[1][1]), debugColor1);

scene->addLine(QLineF(fControlPoints[1][0], fControlPoints[1][1],
fControlPoints[2][0], fControlPoints[2][1]), debugColor2);

scene->addLine(QLineF(fControlPoints[2][0], fControlPoints[2][1],
fControlPoints[3][0], fControlPoints[3][1]), debugColor3);

// Debug control points
scene->addEllipse(fControlPoints[0][0]-3.5, fControlPoints[0][1]-3.5, 7, 7, QPen(), QBrush(debugColor3));
scene->addEllipse(fControlPoints[1][0]-3.5, fControlPoints[1][1]-3.5, 7, 7, QPen(), QBrush(debugColor3));
scene->addEllipse(fControlPoints[2][0]-3.5, fControlPoints[2][1]-3.5, 7, 7, QPen(), QBrush(debugColor3));
scene->addEllipse(fControlPoints[3][0]-3.5, fControlPoints[3][1]-3.5, 7, 7, QPen(), QBrush(debugColor3));
#endif

double aTotalLen = pythag<double>(
fControlPoints[0][0] - fControlPoints[1][0],
Expand All @@ -183,18 +192,12 @@ void CBezierCurve::DrawOnImage(cv::Mat& nImg, const cv::Scalar& nColor)

float prev_x{}, prev_y{};
for (int i = 0; i < aNumOfPts; i++) {
float xa =
GetPt(fControlPoints[0][0], fControlPoints[1][0], i * aInterval);
float ya =
GetPt(fControlPoints[0][1], fControlPoints[1][1], i * aInterval);
float xb =
GetPt(fControlPoints[1][0], fControlPoints[2][0], i * aInterval);
float yb =
GetPt(fControlPoints[1][1], fControlPoints[2][1], i * aInterval);
float xc =
GetPt(fControlPoints[2][0], fControlPoints[3][0], i * aInterval);
float yc =
GetPt(fControlPoints[2][1], fControlPoints[3][1], i * aInterval);
float xa = GetPt(fControlPoints[0][0], fControlPoints[1][0], i * aInterval);
float ya = GetPt(fControlPoints[0][1], fControlPoints[1][1], i * aInterval);
float xb = GetPt(fControlPoints[1][0], fControlPoints[2][0], i * aInterval);
float yb = GetPt(fControlPoints[1][1], fControlPoints[2][1], i * aInterval);
float xc = GetPt(fControlPoints[2][0], fControlPoints[3][0], i * aInterval);
float yc = GetPt(fControlPoints[2][1], fControlPoints[3][1], i * aInterval);

float xxa = GetPt(xa, xb, i * aInterval);
float yya = GetPt(ya, yb, i * aInterval);
Expand All @@ -208,29 +211,36 @@ void CBezierCurve::DrawOnImage(cv::Mat& nImg, const cv::Scalar& nColor)
prev_x = xxx;
prev_y = yyy;
} else {
cv::line(
nImg, cv::Point2f(prev_x, prev_y), cv::Point2f(xxx, yyy),
nColor);
scene->addLine(prev_x, prev_y, xxx, yyy, pen);

prev_x = xxx;
prev_y = yyy;
}

#ifdef _DEBUG
circle(
nImg, cv::Point2f(fControlPoints[0][0], fControlPoints[0][1]), 7,
cv::Scalar(255, 0, 0));
circle(
nImg, cv::Point2f(fControlPoints[1][0], fControlPoints[1][1]), 7,
cv::Scalar(255, 0, 0));
circle(
nImg, cv::Point2f(fControlPoints[2][0], fControlPoints[2][1]), 7,
cv::Scalar(255, 0, 0));
circle(
nImg, cv::Point2f(fControlPoints[3][0], fControlPoints[3][1]), 7,
cv::Scalar(255, 0, 0));
// Draw debug circles on each point of the curve
for (int i = 0; i < aNumOfPts; i++) {
float xa = GetPt(fControlPoints[0][0], fControlPoints[1][0], i * aInterval);
float ya = GetPt(fControlPoints[0][1], fControlPoints[1][1], i * aInterval);
float xb = GetPt(fControlPoints[1][0], fControlPoints[2][0], i * aInterval);
float yb = GetPt(fControlPoints[1][1], fControlPoints[2][1], i * aInterval);
float xc = GetPt(fControlPoints[2][0], fControlPoints[3][0], i * aInterval);
float yc = GetPt(fControlPoints[2][1], fControlPoints[3][1], i * aInterval);

float xxa = GetPt(xa, xb, i * aInterval);
float yya = GetPt(ya, yb, i * aInterval);
float xxb = GetPt(xb, xc, i * aInterval);
float yyb = GetPt(yb, yc, i * aInterval);

float xxx = GetPt(xxa, xxb, i * aInterval);
float yyy = GetPt(yya, yyb, i * aInterval);

// Add a circle for this point
scene->addEllipse(xxx - 1.5, yyy - 1.5, 3, 3, QPen(), QBrush(Qt::yellow)); // yellow for visibility
}
#endif // _DEBUG
}
}


#pragma clang diagnostic pop
6 changes: 4 additions & 2 deletions apps/VC/CBezierCurve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include <opencv2/core.hpp>

#include "MathUtils.hpp"
#include <QGraphicsEllipseItem>
#include <QGraphicsView>
#include <QGraphicsScene>

namespace ChaoVis
{
Expand All @@ -28,8 +31,7 @@ class CBezierCurve
void GetSamplePoints(std::vector<Vec2<double>>& nSamplePoints);
void GetSamplePoints(std::vector<cv::Vec2f>& nSamplePoints);

void DrawOnImage(
cv::Mat& nImg, const cv::Scalar& nColor = cv::Scalar(0, 0, 255));
void DrawOnImage(QGraphicsScene* scene, const QColor& color = QColor(0, 0, 255));

protected:
private:
Expand Down
14 changes: 12 additions & 2 deletions apps/VC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# VC Main app
set(target VC)
set(CMAKE_AUTORCC ON)

set(srcs
CSimpleNumEditBox.cpp
VCAppMain.cpp
CMesh.cpp
CWindow.cpp
Expand All @@ -14,6 +14,8 @@ set(srcs
CBezierCurve.cpp
BlockingDialog.hpp
ColorFrame.hpp
SettingsDialog.cpp
UndoCommands.cpp
)

set(MACOSX_BUNDLE_ICON logo.icns)
Expand All @@ -32,7 +34,7 @@ string(CONCAT info_string
${copyright}
)

add_executable(${target} ${srcs})
add_executable(${target} ${srcs} resources.qrc)
set_target_properties(${target} PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
Expand All @@ -55,6 +57,11 @@ target_include_directories(${target}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
find_package(OpenMP)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
find_package(GSL REQUIRED)
include_directories(${GSL_INCLUDE_DIRS})
target_link_libraries(${target}
VC::core
VC::meshing
Expand All @@ -63,6 +70,9 @@ target_link_libraries(${target}
Qt6::Gui
Qt6::Widgets
${OSXSecurity}
OpenMP::OpenMP_CXX
${SDL2_LIBRARIES}
${GSL_LIBRARIES}
)

if (${VC_INSTALL_APPS})
Expand Down
71 changes: 0 additions & 71 deletions apps/VC/CSimpleNumEditBox.cpp

This file was deleted.

Loading

0 comments on commit 65aa13d

Please sign in to comment.