Read Nifti image with ITK in C++ - vtk

I am sorry if the question is primitive, but I can't figure the problem. I want to read nifti image in C++ using ITK libraries. I have used the code on Github: https://gist.github.com/rafamanzo/a3c258f4f74e898e9418. It is very simple code to read an image. Then I configured ITK into my project using CMake. The following is my CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8)
project(MyProject)
set(CMAKE_INSTALL_PREFIX "/home/itk")
set(ITK_DIR "/home/itk/InsightToolkit-4.13.0/bin/")
set(VTK_DIR "/home/vtk/VTK-8.1.0/bin/")
find_package(ITK REQUIRED)
find_package(VTK REQUIRED)
if (ITKVtkGlue_LOADED)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
else()
find_package(ItkVtkGlue REQUIRED)
include(${ItkVtkGlue_USE_FILE})
set(Glue ItkVtkGlue)
endif()
include(${ITK_USE_FILE})
include(${VTK_USE_FILE})
add_executable(MyProject mainFile.cxx)
target_link_libraries(MyProject ${ITK_LIBRARIES})
"cmake .." is ran successfully.
But "make all" gives me an error:
make[2]: *** No rule to make target '/home/vtk/VTK-8.1.0/bin/lib/libvtkRenderingOpenGL2.so', needed by 'MyProject'. Stop.
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/MyProject.dir/all' failed
make[1]: *** [CMakeFiles/MyProject.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
And surprisingly, when I build the project from Eclipse, I got another error:
./bin/CMakeFiles/feature_tests.o: In function `main':
/home/MyProject/Debug/../bin/CMakeFiles/feature_tests.c:34: multiple definition of `main'
makefile:32: recipe for target 'MyProject' failed
./bin/CMakeFiles/3.6.2/CompilerIdC/CMakeCCompilerId.o:/home/MyProject/Debug/../bin/CMakeFiles/3.6.2/CompilerIdC/CMakeCCompilerId.c:540: first defined here
/usr/bin/ld: cannot find -l/home/vtk/VTK-8.1.0/bin/lib/libvtkRenderingContextOpenGL2-8.1.so
collect2: error: ld returned 1 exit status
make: *** [MyProject] Error 1
I am pretty sure that configuring ITK is easy, especially I have done it before, but to use ImageFileReader only. Any help is much appreciated. Thank you.

Just to read an image you don't need VTKGlue part of ITK nor VTK itself. And the reported problem comes from VTK. If you want to keep VTK (to be used for something else?), you should fix it. Maybe you need to set VTK_RENDERING_BACKEND to OpenGL2 or something similar. Try building some VTK examples using your VTK to see if those examples build and run. That might point you more precisely to the problem.

Related

Error building libgfortran_6.2.bb recipe in morty: backtrace-supported.h: No such file or directory

I am trying to build the libgfortran_6.2.bb recipe in Morty.
I have included in my local.conf:
FORTRAN_forcevariable = ",fortran"
RUNTIMETARGET_append_pn-gcc-runtime = " libquadmath libgfortran"
IMAGE_INSTALL_append = " gfortran gfortran-symlinks libgfortran libgfortran-dev"
But I get the error:
../../../../../../../../work-shared/gcc-linaro-6.3-r2017.02/git/libgfortran/runtime/backtrace.c:37:33: fatal error: backtrace-supported.h: No such file or directory compilation terminated.
Makefile:2419: recipe for target 'backtrace.lo' failed make[1]: *** [backtrace.lo] Error 1
How can this be solved?
Unfortunately the fortran support in OE was broken for quite some time. This patch series brought in the needed fixes, but did not arrive before the rocko release development cycle. The series looks simple enough to be backported for your specific needs if desired, otherwise check if you can just forward your project to rocko.

Can't compile QT 5.5.1 on Amazon Centos: Project ERROR: Unknown module(s) in QT: quick

I am trying to compile QT 5.5.1 on Amazon AMI 2015.09, which looks la lot like Centos 6.5.
I keep getting this error:
Project ERROR: Unknown module(s) in QT: quick
However, there is no quick module that I can find, and no obvious way to enable to disable it from looking at the ./configure script.
My procedure:
I downloaded qt-everywhere-opensource-src-5.5.1.tar.gz
I unpacked it.
I ran ./configure
Confirmed that I want the opensource license and agreed to the LGPL.
Ran gmake -j4 (but I get the same behavior with gmake.
Interestingly, make distclean gives me this error:
Project ERROR: Unknown module(s) in QT: quick-private
Here are all of the errors sent to STDERR:
Checking for openal... Checking for bluez... no
Checking for bluez_le... no
Checking for btapi10_2_1... no
/home/ec2-user/qt-everywhere-opensource-src-5.5.1/qtmultimedia/qtmultimedia.pro:28: Variable GST_VERSION is not defined.
Checking for resourcepolicy... no
Checking for gpu_vivante... no
Checking for libbb2... no
no
Project MESSAGE: Unsupported Bluetooth platform, will not build a working QtBluetooth library.
Project MESSAGE: Either no Qt D-Bus found or no BlueZ headers.
qbluetoothdevicediscoveryagent_p.h:0: Note: No relevant classes found. No output generated.
qbluetoothservicediscoveryagent_p.h:0: Note: No relevant classes found. No output generated.
qbluetoothserver_p.h:0: Note: No relevant classes found. No output generated.
qbluetoothlocaldevice_p.h:0: Note: No relevant classes found. No output generated.
Checking for assimp... no
Project ERROR: Unknown module(s) in QT: quick
gmake[4]: *** [sub-textureandlight-make_first] Error 3
gmake[3]: *** [sub-canvas3d-make_first] Error 2
gmake[2]: *** [sub-canvas3d-make_first] Error 2
gmake[1]: *** [sub-examples-make_first] Error 2
gmake: *** [module-qtcanvas3d-make_first] Error 2
gmake: *** Waiting for unfinished jobs....
At another poster's suggestion I tried ./configure -skip qtquick but that didn't work:
$ ./configure -skip qtquick
+ cd qtbase
+ /home/ec2-user/qt-everywhere-opensource-src-5.5.1/qtbase/configure -top-level -skip qtquick
Attempting to skip non-existent module qtquick.
$
this is what I think will solve your problems:
You have use `make confclean' instead of making distclean for deleting the previous configuration.
Configure in verbose mode — more information will be provided, sorry, I don't remember exact flag, if I'm not mistaken, it's -v.
If you don't need quick, add -skip qtquick to the configure.

glfw makefile fails upon "generating html documentation" on Ubuntu

I am trying to compile and install glfw 3.1.1 for Ubuntu 14.10. The cmake finished successfully, however, when I go to execute the makefile through make it fails at the following:
[ 98%] Building C object tests/CMakeFiles/windows.dir/windows.c.o
Linking C executable windows
[ 98%] Built target windows
Scanning dependencies of target docs
[100%] Generating HTML documentation
Error: tag HTML_HEADER: header file `/home/dennis/Documents/LearningOpenGL/glfw-3.1.1/docs/header.html' does not exist
docs/CMakeFiles/docs.dir/build.make:52: recipe for target 'docs/CMakeFiles/docs' failed
make[2]: *** [docs/CMakeFiles/docs] Error 1
CMakeFiles/Makefile2:1184: recipe for target 'docs/CMakeFiles/docs.dir/all' failed
make[1]: *** [docs/CMakeFiles/docs.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
At first I thought that it is failing an optional step but then I realized that I can't compile my test project as it complains about the glfw header:
main.cpp:2:24: fatal error: GLFW/glfw3.h: No such file or directory
#include <GLFW/glfw3.h>
Thanks
Found the answer! I had to disable the "build documentation" option in the cmake gui.
It seems you just skip compiling the doc instead of fix it.
Simply go to docs/CMakeFiles/docs.dir, modify the file build.make.
For the build target docs/CMakeFiles/docs:, change the doxygen command
from:
doxygen.exe
to
doxygen.exe .

build octave package from source

I want to install octaviz package in octave software.
From the documentation there is stated:
-You'll need octave 2.1.53 or later and VTK CVS to build octaviz. To compile octaviz, run ccmake . in the root directory of the source tree, then make and finally make install.
I first ran ccmake ., and it completed successfully after I installed some libs that I was missing.
But, the I ran "make" and it exits with the following errors:
>> make
[ 1%] Built target vtkWrapOctave
[ 1%] Building CXX object Common/CMakeFiles/octaviz.dir/octaviz.o
/home/user12345/octave/octaviz/Common/octaviz.cc:31:24: fatal error: octave/oct.h: No such file or directory
#include <octave/oct.h>
^
compilation terminated.
make[2]: *** [Common/CMakeFiles/octaviz.dir/octaviz.o] Error 1
make[1]: *** [Common/CMakeFiles/octaviz.dir/all] Error 2
make: *** [all] Error 2
Any idea what I am missing here?
You are missing the octave/oct.h header. This usually means that you don't have Octave installed. If you do have it installed, maybe you are missing the header files and shared libraries (if you are using Linux, did you install octave's -dev or -devel packaqes?) If you have them installed, you must have ran the configure script incorrectly. Either specify the correct options or set the CXX_FLAGS. If you don't know about compiler flags you probably should not change them and instead figure out how to install the octave libraries correctly.

using mupdf ndk-build error

I am trying to use mupdf in android application.I am using windows 7 and cygwin terminal.I used make but it gave error and
make NOX11=yes
execute successfully.
then i used ndk-build and it gives this error.
SharedLibrary : libmupdf.so
c:/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libmupdfcore.a(pdf_fontfile.o)(.text.pdf_lookup_builtin_font+0x18): unresolvable R_ARM_THM_CALL relocation against symbol `strcmp'
c:/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld.exe: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
/cygdrive/c/android-ndk-r8b/build/core/build-binary.mk:378: recipe for target `obj/local/armeabi/libmupdf.so' failed
make: *** [obj/local/armeabi/libmupdf.so] Error 1
please help me.I am new to android ndk.
Thank you.
This seems like a known issue. Try adding the line:
NDK_TOOLCHAIN_VERSION=4.4.3
to the file ..\android\jin\Application.mk. That will at least get rid of this particular error.
EDIT: Look here http://code.google.com/p/android/issues/detail?id=35393 for more information
UPDATE:
mupdf world is a murky one. Even the version of NDK vis-a-vis the version of mupdf (http://mupdf.com/download/archive/) you use will determine what sort of errors or warnings you get. From my experience, mupdf-0.9 (+mupdf-thirdparty-2011-02-24.zip) behaves well with android-ndk-r6b, while mupdf-1.1 (+mupdf-thirdparty-2012-08-14.zip) will behave just fine with android-ndk-r8b.

Resources