There are many IDE's available. I use Screen/ Vim/ CTAGS/ GDB to setup my programming environment.
screen -S DavidFuentes
CNTL-a c
CNTL-a S
CNTL-a n CNTL-a p
CNTL-a X
CNTL-a |
CNTL-a CNTL-i CNTL-a :focus up/down
CNTL-a Q
CNTL-a d
screen -rd DavidFuentes
CNTL-a [ CNTL-u CNTL-d
CNTL-a [ space highlight w/ cursor (arrow keys) space
CNTL-a ]
Download code and build.
wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.5.1.tar.gz tar -zxf petsc-lite-3.5.1.tar.gz cd petsc-3.5.1 ./config/configure.py --with-shared-libraries --with-clanguage=c++ --CFLAGS='-O0' --CXXFLAGS='-O0' --download-ctetgen --download-triangle --with-debugging=yes --with-blas-lapack-dir=/opt/apps/MKL/12.1/lib/intel64/ --with-exodusii-lib=[/usr/lib/x86_64-linux-gnu/libexoIIv2.so] --with-netcdf-dir=/usr/lib --with-hdf5-dir=/usr/lib --with-c2html=0 --with-exodusii-include=/usr/include --with-opencl-include=/usr/include/ --with-opencl-lib=/usr/lib/libOpenCL.so --download-viennacl=yes make
Download code and build.
wget http://downloads.sourceforge.net/project/itk/itk/4.6/InsightToolkit-4.6.0.tar.gz tar -xvzf InsightToolkit-4.6.0.tar.gz mkdir InsightToolkit-4.6.0-build cd InsightToolkit-4.6.0-build cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DBUILD_EXAMPLES=ON -DBUILD_TESTING=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=../InsightToolkit-4.6.0-install ../InsightToolkit-4.6.0 make -j 10 ; make install
cd InsightToolkit-4.6.0 ctags -R --langmap=c++:+.txx --langmap=c++:+.hxx --langmap=c++:+.cl * cd petsc-3.5.1 ctags -R --langmap=c++:+.txx --langmap=c++:+.hxx --langmap=c++:+.cl *
[1] vim /opt/apps/ITK/InsightToolkit-4.6.0/Examples/IO/DicomSeriesReadImageWrite2.cxx [2] :set tags=/opt/apps/ITK/InsightToolkit-4.6.0/tags
[1] Search for function /GetSeriesUIDs [2] Follow tag g] Prints places in source code where you find instances of the function on the line you were on. Select the number of the instance you would like to look at and press enter. [3] Goes to last tagged instance. CNTL-t
:ta GPU<tab>
$ /opt/apps/ITK/InsightToolkit-4.6.0-build/bin/DicomSeriesReadImageWrite2 Usage: /opt/apps/ITK/InsightToolkit-4.6.0-build/bin/DicomSeriesReadImageWrite2 DicomDirectory outputFileName [seriesName] $ /opt/apps/ITK/InsightToolkit-4.6.0-build/bin/DicomSeriesReadImageWrite2 sample1 sample1.nii.gz The directory: sample1 Contains the following DICOM Series: 1.3.12.2.1107.5.2.32.35177.3.2006121409284535196417894.0.0.0.4tfl3d1ns125625620061214 1.3.12.2.1107.5.2.32.35177.3.2006121409371282268118605.0.0.0.5tfl3d1ns125625620061214 1.3.12.2.1107.5.2.32.35177.3.2006121409455295707319315.0.0.0.6spc3d1278ns125625620061214 Now reading series: 1.3.12.2.1107.5.2.32.35177.3.2006121409284535196417894.0.0.0.4tfl3d1ns125625620061214 Writing the image as sample1.nii.gz
$ gdb --args /opt/apps/ITK/InsightToolkit-4.6.0-build/bin/DicomSeriesReadImageWrite2 sample1 sample1.nii.gz GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /opt/apps/ITK/InsightToolkit-4.6.0-build/bin/DicomSeriesReadImageWrite2...done. (gdb) r Starting program: /opt/apps/ITK/InsightToolkit-4.6.0-build/bin/DicomSeriesReadImageWrite2 sample1 sample1.nii.gz [Thread debugging using libthread_db enabled] The directory: sample1 Contains the following DICOM Series: 1.3.12.2.1107.5.2.32.35177.3.2006121409284535196417894.0.0.0.4tfl3d1ns125625620061214 1.3.12.2.1107.5.2.32.35177.3.2006121409371282268118605.0.0.0.5tfl3d1ns125625620061214 1.3.12.2.1107.5.2.32.35177.3.2006121409455295707319315.0.0.0.6spc3d1278ns125625620061214 Now reading series: 1.3.12.2.1107.5.2.32.35177.3.2006121409284535196417894.0.0.0.4tfl3d1ns125625620061214 Writing the image as sample1.nii.gz Program exited normally.
(gdb) b 183 (gdb) b nifti_image_write Breakpoint 2 at 0x988513: file /opt/apps/ITK/InsightToolkit-4.6.0/Modules/ThirdParty/NIFTI/src/nifti/niftilib/nifti1_io.c, line 5879. (gdb) r
(gdb) bt #0 nifti_image_write (nim=0x4b51870) at /opt/apps/ITK/InsightToolkit-4.6.0/Modules/ThirdParty/NIFTI/src/nifti/niftilib/nifti1_io.c:5879 #1 0x0000000000770b04 in itk::NiftiImageIO::Write (this=0x4b55190, buffer=0x7ffff1c35010) at /opt/apps/ITK/InsightToolkit-4.6.0/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx:1854 #2 0x00000000005dcfaa in itk::ImageFileWriter<itk::Image<short, 3u> >::GenerateData (this=0x476e0c0) at >/opt/apps/ITK/InsightToolkit-4.6.0/Modules/IO/ImageBase/include/itkImageFileWriter.hxx:421 #3 0x00000000005db21f in itk::ImageFileWriter<itk::Image<short, 3u> >::Write (this=0x476e0c0) at >/opt/apps/ITK/InsightToolkit-4.6.0/Modules/IO/ImageBase/include/itkImageFileWriter.hxx:355 #4 0x00000000005d843d in itk::ImageFileWriter<itk::Image<short, 3u> >::Update (this=0x476e0c0) at >/opt/apps/ITK/InsightToolkit-4.6.0/Modules/IO/ImageBase/include/itkImageFileWriter.h:166 #5 0x00000000005d51ae in main (argc=3, argv=0x7fffffffe5c8) at /opt/apps/ITK/InsightToolkit-4.6.0/Examples/IO/DicomSeriesReadImageWrite2.cxx:316 up/down move in the stack frame. Just remember that the higher number called the routine in the frame below it. Or (#7 called #6, #6 called #5, #5 called #4, and so on).
rbreak regex Set breakpoints on all functions matching the regular expression regex. This command sets an unconditional breakpoint on all matches, printing a list of all breakpoints it set. Once these breakpoints are set, they are treated just like the breakpoints set with the break command. You can delete them, disable them, or make them conditional the same way as any other breakpoint. The syntax of the regular expression is the standard one used with tools like grep. Note that this is different from the syntax used by shells, so for instance foo* matches all functions that include an fo followed by zero or more os. There is an implicit .* leading and trailing the regular expression you supply, so to match only functions that begin with foo, use ^foo. When debugging C++ programs, rbreak is useful for setting breakpoints on overloaded functions that are not members of any special classes. The rbreak command can be used to set breakpoints in all the functions in a class vtkExodusIIWriter, like this: (gdb) rbreak ^vtkExodusIIWriter:: rbreak file:regex If rbreak is called with a filename qualification, it limits the search for functions matching the given regular expression to the specified file. This can be used, for example, to set breakpoints on every function in a given file: (gdb) rbreak file.c:. The colon separating the filename qualifier from the regex may optionally be surrounded by spaces.
vim [filename]
:sp :vsp
CNTL-w then k/j/h/l
u
CNTL r
k/j/h/l
i
a
.
yy
7yy
y$
y^
dd
5dd
d$
d^
4dd p
CNTL v ( start visual block ) 10j ( move cursor down 10 lines ) I ( insert ) <text>
CNTL v ( start visual block ) 12j ( move cursor down 10 lines ) $ ( move cursor to end of lines ) x ( cut ) p ( paste )
CNTL v ( start visual block ) G ( move cursor to end of file ) $ ( move cursor to end of lines ) : ( initialize search i ) :'<,'>s/current/replace/g
0 $
/[search_term] Searches for [search_term] When searching it may be useful to use the following command to tell VIM to ignore the case (case insensitive): :set ic
?
n N
/^word /word$
/[a-z] /[0-9]
* #
^M
/CNTL v CNTL m
[1] m[a,b,c,...(any char)] (Marks that line for later use) [2] '[a,b,c,...(char that you marked)] Look to [1]. This takes you to the line you marked. (Use apostrophe)
CNTL o
:1 :11
G
%
H M L
z [enter]
zz
z-
:make :copen