help > How to build V3D and Matlab toolbox
Showing 1-2 of 2 posts
Aug 31, 2011 03:08 PM | Hanchuan Peng
How to build V3D and Matlab toolbox
(I am re-posting here using a more informative
subject, so it would be easier for interested people to know how to
build V3D, & the Matlab toolbox)
How to build V3D and Matlab
toolbox
There are two separate issues: (1) build V3D or not, (2)
build the V3D IO Matlab toolbox or not.
For the first issue, you will need qt (of course). You can download the
src code (NOT the pre-compiled one) from qt website at nokia.com. Then
simply run an untar command like this (on Mac or Unix like system)
tar zxvf qt_what_ever.tar.gz
Then you can compile qt using the commands like (need to first enter the untarred qt folder)
./configure -nomake examples
make
sudo make install
Once you have qt, then build V3D is just one command (need to enter v3d src code folder)
./build.macx -B -m
The options -m will tell to build 64bit version. -B tells you to rebuild everything.
But this command, when runs for the first time, also automatically untar
the bundled boost, fftw, tiff, libraries in V3D. These include files,
libraries, etc will be put (automatically!) into v3d_main/common_lib
folder. After that, this command will build V3D and the plugins
automatically.
Thus it is clear that if you only need libtiff, you can simple run this
command. When it stops and indicates that no qt exists, etc, just ignore
the message. Of course, if you want to build V3D at the first place,
you will not see these erroreneous msgs.
Once you have the libtiff, you are ready to build the Matlab toolbox.
There is one special note: Matlab software itself uses an old version of
libtiff, which should be replaced by the libtiff library file you would
produce in the above way. That old Matlab library file can be found in
/Path_to_matlab/bin/maci64 (assuming you will need 64bit matlab).
-Hanchuan
For the first issue, you will need qt (of course). You can download the
src code (NOT the pre-compiled one) from qt website at nokia.com. Then
simply run an untar command like this (on Mac or Unix like system)
tar zxvf qt_what_ever.tar.gz
Then you can compile qt using the commands like (need to first enter the untarred qt folder)
./configure -nomake examples
make
sudo make install
Once you have qt, then build V3D is just one command (need to enter v3d src code folder)
./build.macx -B -m
The options -m will tell to build 64bit version. -B tells you to rebuild everything.
But this command, when runs for the first time, also automatically untar
the bundled boost, fftw, tiff, libraries in V3D. These include files,
libraries, etc will be put (automatically!) into v3d_main/common_lib
folder. After that, this command will build V3D and the plugins
automatically.
Thus it is clear that if you only need libtiff, you can simple run this
command. When it stops and indicates that no qt exists, etc, just ignore
the message. Of course, if you want to build V3D at the first place,
you will not see these erroreneous msgs.
Once you have the libtiff, you are ready to build the Matlab toolbox.
There is one special note: Matlab software itself uses an old version of
libtiff, which should be replaced by the libtiff library file you would
produce in the above way. That old Matlab library file can be found in
/Path_to_matlab/bin/maci64 (assuming you will need 64bit matlab).
-Hanchuan
Aug 31, 2011 09:08 PM | Mark Schroeder
RE: How to build V3D and Matlab toolbox
Thanks a lot for the clarification.
Compiling the Matlab toolbox works once I compile the rest of v3d and modify the mex calls in makeosmex_rawfile_io.m (my modified version is attached):
mex loadRaw2Stack_c.cpp mg_image_lib.cpp mg_utilities.cpp -L../v3d_main/common_lib/lib -lv3dtiff -I../v3d_main/common_lib/include
mex saveStack2File_c.cpp mg_image_lib.cpp mg_utilities.cpp -L../v3d_main/common_lib/lib -lv3dtiff -I../v3d_main/common_lib/include
There are still warnings, but I loaded a v3draw stack using load_v3d_raw_img_file and could view the slices so it seems to be functional. The warnings were primarily "deprecated conversion from string constant to 'char*'", but there were a few instances of warnings where long int or long unsigned int were used instead of int:
basic_memory.cpp:108: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
mg_utilities.cpp:601: warning: field precision should have type 'int', but argument 3 has type 'long unsigned int'
mg_utilities.cpp:601: warning: field precision should have type 'int', but argument 3 has type 'long unsigned int'
If this might be problematic please let me know.
As a side note, I had been using gcc 4.4 from porticus and it didn't work compiling either qt or v3d, but gcc-4.2, which comes with xcode, cleared up these problems. That made things a bit more confusing for me.
Compiling the Matlab toolbox works once I compile the rest of v3d and modify the mex calls in makeosmex_rawfile_io.m (my modified version is attached):
mex loadRaw2Stack_c.cpp mg_image_lib.cpp mg_utilities.cpp -L../v3d_main/common_lib/lib -lv3dtiff -I../v3d_main/common_lib/include
mex saveStack2File_c.cpp mg_image_lib.cpp mg_utilities.cpp -L../v3d_main/common_lib/lib -lv3dtiff -I../v3d_main/common_lib/include
There are still warnings, but I loaded a v3draw stack using load_v3d_raw_img_file and could view the slices so it seems to be functional. The warnings were primarily "deprecated conversion from string constant to 'char*'", but there were a few instances of warnings where long int or long unsigned int were used instead of int:
basic_memory.cpp:108: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
mg_utilities.cpp:601: warning: field precision should have type 'int', but argument 3 has type 'long unsigned int'
mg_utilities.cpp:601: warning: field precision should have type 'int', but argument 3 has type 'long unsigned int'
If this might be problematic please let me know.
As a side note, I had been using gcc 4.4 from porticus and it didn't work compiling either qt or v3d, but gcc-4.2, which comes with xcode, cleared up these problems. That made things a bit more confusing for me.
