Mrview - View options Segmentation Fault

Hello,

I have an issue with MRview : I have loaded an image using the command lines and when I try to open the “View options” section, Mrview crashes and I have the error “Segmentation fault”.

My configuration is :

MRtrix build type requested: release version
Detecting OS: windows
Looking for compiler [g++]: g++.exe (Rev2, Built by MSYS2 project) 9.2.0
Checking for C++11 compliance: ok
Checking shared library generation: ok
Detecting pointer size: 64 bit
Detecting byte order: little-endian
Checking for variable-length array support: ok
Checking for non-POD variable-length array support: ok
Checking for ::max_align_t: 16 bytes
Checking for std::max_align_t: 16 bytes
Checking for Eigen3 library: 3.3.7
Checking for zlib compression library: 1.2.11
Checking for "JSON for Modern C++" requirements: ok
Checking for TIFF library: LIBTIFF, Version 4.1.0
Checking for FFTW library: fftw-3.3.8-sse2-avx
Checking for Qt moc: moc (version 5.13.2)
Checking for Qt qmake: qmake (version 5.13.2)
Checking for Qt rcc: rcc (version 5.13.2)
Checking for Qt: 5.13.2
writing configuration to file './config': ok

In the debug mode, I have the following information for mrview :

mrview: [DEBUG] No config file found at "/etc/mrtrix.conf"
mrview: [DEBUG] No config file found at "E:\msys64\home\LMU4\.mrtrix.conf"
mrview: [INFO] GL renderer:  Quadro M2200/PCIe/SSE2
mrview: [INFO] GL version:   3.3.0 NVIDIA 391.03
mrview: [INFO] GL vendor:    NVIDIA Corporation

Finally, I had an issue during the compilation :

(366/506) [CC] tmp/src/gui/mrview/colourmap_button_moc.o

g++ -c -std=c++11 -DMRTRIX_BUILD_TYPE="release version" -pthread -DMRTRIX_WINDOWS -mms-bitfields -Wa,-mbig-obj -D_FILE_OFFSET_BITS=64 -DMRTRIX_WORD64 -DMRTRIX_TIFF_SUPPORT -DEIGEN_FFTW_DEFAULT -Wall -O3 -DNDEBUG -Isrc -I./core -Icmd -idirafter /mingw64/include/eigen3 -DEIGEN_DONT_PARALLELIZE -fno-keep-inline-dllexport -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -idirafter /mingw64/include/QtOpenGL -idirafter /mingw64/include/QtSvg -idirafter /mingw64/include/QtWidgets -idirafter /mingw64/include/QtGui -idirafter /mingw64/include/QtCore -idirafter release -idirafter /mingw64/share/qt5/mkspecs/win32-g++ src/gui/opengl/gl_core_3_3.cpp -o tmp/src/gui/opengl/gl_core_3_3.o:

src/gui/opengl/gl_core_3_3.cpp: In function 'void gl::Switch_BlendFunc(GLenum, GLenum)':
src/gui/opengl/gl_core_3_3.cpp:88:55: warning: cast between incompatible function types from 'PROC' {aka 'long long int (*)()'} to 'gl::PFNBLENDFUNCPROC' {aka 'void (*)(unsigned int, unsigned int)'} [-Wcast-function-type]
   88 | #define IntGetProcAddress(name) WinGetProcAddress(name)
      |                                                       ^
src/gui/opengl/gl_core_3_3.cpp:850:33: note: in expansion of macro 'IntGetProcAddress'

Thank you in advance for your help,
Best Regards,
Louise

I can’t see anything unusual in what you’re showing. The compilation issue is just a warning, and I get those all the time on Windows…

Can you add the -debug flag to your mrview command line, and post the output so we can see what happens leading up to the crash?

And can you post your exact command line so we can try to reproduce the issue on our own systems?

The exact step I am doing are the following :

  • mrview dwi.mif
  • Then “Tool -> View options”
    And mrview does not open the “View options” panel, it just closes.

The debug output is the following :

$ mrview Partners1_dwiDesnoisedNLMOtsu.mif -debug
mrview: [DEBUG] No config file found at "/etc/mrtrix.conf"
mrview: [DEBUG] No config file found at "E:\msys64\home\LMU4\.mrtrix.conf"
mrview: [INFO] GL renderer:  Quadro M2200/PCIe/SSE2
mrview: [INFO] GL version:   3.3.0 NVIDIA 391.03
mrview: [INFO] GL vendor:    NVIDIA Corporation
mrview: [DEBUG] loading font into OpenGL texture...
mrview: [DEBUG] compiling OpenGL vertex shader:
#version 330 core
layout(location = 0) in vec2 pos;
layout(location = 1) in vec2 font_pos;
uniform float scale_x;
uniform float scale_y;
out vec2 tex_coord;
void main () {
  gl_Position = vec4 (pos[0]*scale_x-1.0, pos[1]*scale_y-1.0, 0.0, 1.0);
  tex_coord = font_pos;
}

mrview: [DEBUG] compiling OpenGL fragment shader:
#version 330 core
in vec2 tex_coord;
uniform sampler2D sampler;
uniform float red, green, blue;
out vec4 color;
void main () {
  color.ra = texture (sampler, tex_coord).rg;
  color.rgb = color.r * vec3 (red, green, blue);
}

mrview: [DEBUG] font loaded
mrview: [INFO] opening image "Partners1_dwiDesnoisedNLMOtsu.mif"...
mrview: [DEBUG] reading key/value file "Partners1_dwiDesnoisedNLMOtsu.mif"...
mrview: [DEBUG] sanitising image information...
mrview: [INFO] image "Partners1_dwiDesnoisedNLMOtsu.mif" opened with dimensions 126x114x69x130, voxel spacing 2x2x2x1, datatype UInt16LE
mrview: [DEBUG] memory-mapping file "Partners1_dwiDesnoisedNLMOtsu.mif"...
mrview: [DEBUG] file "Partners1_dwiDesnoisedNLMOtsu.mif" mapped at 0x10a50000, size 257690160 (read-only)
mrview: [DEBUG] image "Partners1_dwiDesnoisedNLMOtsu.mif" loaded
mrview: [DEBUG] image "Partners1_dwiDesnoisedNLMOtsu.mif" initialised with strides = [ -1 -126 14364 991116 ], start = 14363, using indirect IO
mrview: [DEBUG] compiling OpenGL vertex shader:
#version 330 core
layout(location = 0) in vec3 vertpos;
layout(location = 1) in vec3 texpos;
uniform mat4 MVP;
out vec3 texcoord;
void main() {
  gl_Position =  MVP * vec4 (vertpos,1);
  texcoord = texpos;
}

mrview: [DEBUG] compiling OpenGL fragment shader:
#version 330 core
uniform float offset;
uniform float scale;
uniform sampler3D tex;
in vec3 texcoord;
out vec4 color;
void main() {
  if (texcoord.s < 0.0 || texcoord.s > 1.0 ||
      texcoord.t < 0.0 || texcoord.t > 1.0 ||
      texcoord.p < 0.0 || texcoord.p > 1.0) discard;
  color = texture (tex, texcoord.stp);
  float amplitude = color.r;
  if (isnan(amplitude) || isinf(amplitude)) discard;
  amplitude = clamp ( scale * (amplitude - offset), 0.0, 1.0);
  color.rgb = vec3 (amplitude);
}

mrview: [DEBUG] compiling OpenGL vertex shader:
#version 330 core
layout(location=0) in vec2 pos;
void main () {
  gl_Position = vec4 (pos, 0.0, 1.0);
}

mrview: [DEBUG] compiling OpenGL fragment shader:
#version 330 core
out vec4 color;
void main () {
  color = vec4 (0.5, 0.5, 0.0, 1.0);
}

mrview: [DEBUG] compiling OpenGL vertex shader:
#version 330 core
layout(location=0) in vec3 data;
uniform float scale_x, scale_y;
out float amplitude;
void main () {
  gl_Position = vec4 (data.x*scale_x-1.0, data.y*scale_y-1.0, 0.0, 1.0);
  amplitude = data.z;
}

mrview: [DEBUG] compiling OpenGL fragment shader:
#version 330 core
in float amplitude;
out vec3 color;
uniform vec3 colourmap_colour;
void main () {
  color.rgb = vec3 (amplitude);
}

mrview: [DEBUG] compiling OpenGL fragment shader:
#version 330 core
out vec3 color;
void main () {
  color = vec3(1.0, 1.0, 0.0);
}

Segmentation fault

Finally, my Mrtrix version is : mrview 3.0_RC3_latest-68-gd411e6c5

Thank you

OK, this is due to this recent ‘fix’. I can replicate on my Windows 10 laptop. I guess this must only affect Windows installations, otherwise I don’t understand how we could have let that one slip through the net…

I’ll investigate, hopefully I’ll have a fix shortly.

In the meantime, the simplest thing is to do is revert to the previous commit on master:

git checkout HEAD~1
./build

Tip: once we do issue the fix, you’ll need to reset your installation to point to master before you can pull the changes again:

git checkout master
git pull
./build

OK, it should now be fixed (pull request here)… Please update as per instructions above, and thanks for reporting!

Hello,

So I did the following :
git checkout master
git pull
./build

and everything is working!!

Thank you for your help and time

1 Like

Hello,
this is just to let you know that I had the same issue of @lmoreau on my Mac OSX with Mojave. After the update everything is good.

Thanks @jdtournier

Simona

1 Like