Skip to content

Commit c3ccb0a

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 27607ef + 0f2771a commit c3ccb0a

7 files changed

Lines changed: 42 additions & 30 deletions

File tree

.github/workflows/CI-mac-arm64.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
MACOSX_DEPLOYMENT_TARGET: 11.0
3030
PYTHON_CONFIGURE_OPTS: "--enable-framework"
3131
CFLAGS: "-Wno-implicit-function-declaration"
32-
LDFLAGS: "-L/usr/local/opt/zlib/lib"
32+
LDFLAGS: "-L/usr/local/opt/zlib/lib -framework Foundation"
3333
CPPFLAGS: "-I/usr/local/opt/zlib/include"
3434
PKG_CONFIG_PATH: "/usr/local/opt/zlib/lib/pkgconfig"
3535
uses: "gabrielfalcao/pyenv-action@v18"
@@ -39,7 +39,7 @@ jobs:
3939
- name: Install pip dependencies
4040
run: |
4141
pip3 install --upgrade pip
42-
pip3 install twine wheel==0.37.1
42+
pip3 install twine wheel
4343
4444
- name: Debug
4545
run: |

source/FAST/DeviceManager.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ bool DeviceManager::deviceSatisfiesCriteria(OpenCLDevice::pointer device,
263263

264264

265265
bool DeviceManager::deviceHasOpenGLInteropCapability(const cl::Device &device, const cl::Platform &platform) {
266-
#ifndef _WIN32
266+
#ifdef WIN32
267+
reportInfo() << "Windows detected, disabling OpenGL interop due to random crashes when rendering image and segmentation at the same time." << reportEnd();
268+
return false;
269+
#else
267270
if(platform.getInfo<CL_PLATFORM_VENDOR>().find("NVIDIA") != std::string::npos) {
268271
reportInfo() << "NVIDIA platform was detected on linux, disabling OpenGL interop due to error Xlib extension NV-GLX missing" << reportEnd();
269272
return false;

source/FAST/Visualization/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fast_add_sources(
44
)
55
if(FAST_MODULE_Visualization)
66
fast_add_python_interfaces(Renderer.hpp View.hpp Window.hpp SimpleWindow.hpp DualViewWindow.hpp MultiViewWindow.hpp SlicerWindow.hpp LabelColorRenderer.hpp ComputationThread.hpp)
7-
fast_add_python_shared_pointers(Window SimpleWindow SimpleWindow2D SimpleWindow3D DualViewWindow DualViewWindow2D DualViewWindow3D MultiViewWindow SlicerWindow Renderer View LabelColorRenderer ComputationThread)
7+
fast_add_python_shared_pointers(Window SimpleWindow SimpleWindow2D SimpleWindow3D DualViewWindow DualViewWindow2D DualViewWindow3D MultiViewWindow SlicerWindow Renderer ImageRendererBase View LabelColorRenderer ComputationThread)
88
fast_add_process_object(ImageRenderer ImageRenderer/ImageRenderer.hpp)
99
fast_add_sources(
1010
Window.cpp

source/FAST/Visualization/ImageRenderer/ImageRenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ImageRenderer::~ImageRenderer() {
3636
deleteAllTextures();
3737
}
3838

39-
void ImageRenderer::deleteAllTextures() {
39+
void ImageRendererBase::deleteAllTextures() {
4040
// GL cleanup
4141
for(auto vao : mVAO) {
4242
glDeleteVertexArrays(1, &vao.second);
@@ -138,7 +138,7 @@ void ImageRenderer::draw(Matrix4f perspectiveMatrix, Matrix4f viewingMatrix, flo
138138
}
139139
}
140140

141-
void ImageRenderer::drawTextures(std::unordered_map<uint, std::shared_ptr<SpatialDataObject>> copy, Matrix4f &perspectiveMatrix, Matrix4f &viewingMatrix, bool mode2D, bool useInterpolation, bool useWindowLevel) {
141+
void ImageRendererBase::drawTextures(std::unordered_map<uint, std::shared_ptr<SpatialDataObject>> copy, Matrix4f &perspectiveMatrix, Matrix4f &viewingMatrix, bool mode2D, bool useInterpolation, bool useWindowLevel) {
142142
GLuint filterMethod = useInterpolation ? GL_LINEAR : GL_NEAREST;
143143
for(auto it : copy) {
144144
auto input = std::static_pointer_cast<Image>(it.second);

source/FAST/Visualization/ImageRenderer/ImageRenderer.hpp

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,41 @@
55

66
namespace fast {
77

8+
/**
9+
* @brief Abstract base class use by ImageRenderer and SegmentationRenderer
10+
* @ingroup renderers
11+
*/
12+
class ImageRendererBase : public virtual Renderer {
13+
protected:
14+
ImageRendererBase() {};
15+
virtual void deleteAllTextures();
16+
std::unordered_map<uint, uint> mTexturesToRender;
17+
std::unordered_map<uint, Image::pointer> mImageUsed;
18+
/**
19+
* Timestamp used to generate texture
20+
*/
21+
std::unordered_map<uint, uint64_t> mDataTimestamp;
22+
std::unordered_map<uint, uint> mVAO;
23+
std::unordered_map<uint, uint> mVBO;
24+
std::unordered_map<uint, uint> mEBO;
25+
26+
cl::Kernel mKernel;
27+
28+
// Level and window intensities
29+
float mWindow = -1;
30+
float mLevel = -1;
31+
float m_opacity = -1;
32+
bool m_applyTransformationsIn2D = false;
33+
34+
void drawTextures(std::unordered_map<uint, std::shared_ptr<SpatialDataObject>> copy, Matrix4f &perspectiveMatrix, Matrix4f &viewingMatrix, bool mode2D, bool useInterpolation = false, bool useWindowLevel = true);
35+
};
36+
837
/**
938
* @brief Renders 2D Image data objects, both in 2D and 3D.
1039
*
1140
* @ingroup renderers
1241
*/
13-
class FAST_EXPORT ImageRenderer : public virtual Renderer {
42+
class FAST_EXPORT ImageRenderer : public ImageRendererBase {
1443
FAST_PROCESS_OBJECT(ImageRenderer)
1544
public:
1645
/**
@@ -39,28 +68,7 @@ class FAST_EXPORT ImageRenderer : public virtual Renderer {
3968
void
4069
draw(Matrix4f perspectiveMatrix, Matrix4f viewingMatrix, float zNear, float zFar, bool mode2D, int viewWidth,
4170
int viewHeight);
42-
virtual void deleteAllTextures();
4371

44-
45-
std::unordered_map<uint, uint> mTexturesToRender;
46-
std::unordered_map<uint, Image::pointer> mImageUsed;
47-
/**
48-
* Timestamp used to generate texture
49-
*/
50-
std::unordered_map<uint, uint64_t> mDataTimestamp;
51-
std::unordered_map<uint, uint> mVAO;
52-
std::unordered_map<uint, uint> mVBO;
53-
std::unordered_map<uint, uint> mEBO;
54-
55-
cl::Kernel mKernel;
56-
57-
// Level and window intensities
58-
float mWindow = -1;
59-
float mLevel = -1;
60-
float m_opacity = -1;
61-
bool m_applyTransformationsIn2D = false;
62-
63-
void drawTextures(std::unordered_map<uint, std::shared_ptr<SpatialDataObject>> copy, Matrix4f &perspectiveMatrix, Matrix4f &viewingMatrix, bool mode2D, bool useInterpolation = false, bool useWindowLevel = true);
6472
};
6573

6674
}

source/FAST/Visualization/SegmentationRenderer/SegmentationRenderer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ SegmentationRenderer::SegmentationRenderer(std::map<uint, Color> labelColors, fl
5252
mIsModified = false;
5353
}
5454

55+
5556
void
5657
SegmentationRenderer::draw(Matrix4f perspectiveMatrix, Matrix4f viewingMatrix, float zNear, float zFar, bool mode2D,
5758
int viewWidth,
@@ -506,7 +507,7 @@ void SegmentationRenderer::setOpacity(float opacity, float borderOpacity) {
506507
}
507508

508509
void SegmentationRenderer::deleteAllTextures() {
509-
ImageRenderer::deleteAllTextures();
510+
ImageRendererBase::deleteAllTextures();
510511

511512
// Clear buffer. Useful when processing a new image
512513
// Delete all GL data

source/FAST/Visualization/SegmentationRenderer/SegmentationRenderer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ImagePyramid;
2121
*
2222
* @ingroup renderers
2323
*/
24-
class FAST_EXPORT SegmentationRenderer : public ImageRenderer, public LabelColorRenderer {
24+
class FAST_EXPORT SegmentationRenderer : public ImageRendererBase, public LabelColorRenderer {
2525
FAST_PROCESS_OBJECT(SegmentationRenderer)
2626
public:
2727
FAST_CONSTRUCTOR(SegmentationRenderer,

0 commit comments

Comments
 (0)