Remove default OpenJDK
1
sudo apt-get purge openjdk-\*
download jdk(containing jre) and tar.
add into /etc/profile
1
2JAVA_HOME="/home/newly/Program_Files/Java/jdk1.8.0_65"
PATH="$PATH:$JAVA_HOME/jre/bin:$JAVA_HOME/bin"set newly installed jdk as default jdk.
1
2
3sudo update-alternatives --install "/usr/bin/java" "java" "$JAVA_HOME/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "$JAVA_HOME/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "$JAVA_HOME/bin/javaws" 1
OpenCV
Locate OpenCV:
1 | pkg-config --modversion opencv //version |
Uninstall OpenCV:
- go to the compile package and
make uninstall
- if cannot find the compile package,
sudo find / -name "*opencv*" -exec rm -i {} \;
Install OpenCV:
For Windows: C++(Visual Studio)
- Download latest OpenCV from http://sourceforge.net/projects/opencvlibrary/?source=typ_redirect.
- Make a dir named build. Use cmake to generate OpenCV.sln in build.
- Click OpenCV.sln and CMakeTargets->INSTALL->build. You can build it in both debug and release modes.
- In the environmental variables, add D:\Program Files\OpenCV_3.0.0\build\install\x64\vc11 as OPENCV_DIR, add Path with %OPENCV_DIR%\bin.
- Create a OpenCV project. C/C++->General->Additional Include Directories: $(OPENCV_DIR)\..\..\include
- Linker->General->Additional Library Directories: $(OPENCV_DIR)\lib
- Linker->Input->Additional Dependencies: copy all the lib files. *d.lib means debug mode.
Note that there may be some problems for visual studio to recognize the updated environmental variable. Try to restart the visual studio or recreate the project.
For Linux: install for C++
- pre-install packages
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev - download the required version on https://sourceforge.net/projects/opencvlibrary/
- make and install
1
2
3
4
5mkdir build
cd build
cmake .. //cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
Tips: if you want to install multiple versions of OpenCV, set CMAKE_INSTALL_PREFIX differently for different versions of OpenCV.
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \
-D PYTHON_EXECUTABLE=/usr/bin/python \
-D BUILD_EXAMPLES=ON ..
If want to turn off some modules, use -D BUILD_opencv_xfeatures2d=OFF
Switch between different versions of OpenCV:
switch from version 3.2 to version 2.4 shell
switch from version 2.4 to version 3.2 shell
For Linux: Python(Anaconda)
source activate tgt_env
conda install -c https://conda.binstar.org/menpo opencv
spyder
Then try import cv2
GStreamer+FFmpeg for Ubuntu14.04
Install gst-plugin
1
2sudo add-apt-repository ppa:ddalex/gstreamer
sudo apt-get install gstreamer0.10-*Install gstffmpeg
1
2
3sudo add-apt-repository ppa:mc3man/gstffmpeg-keep
sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
Remote Debugging for Visual Code
Remote-SSH: Open SSH Configuration File ~/.ssh/config
Host jump-box
HostName
User
Port
Host target-box
HostName
User
Port 22
ProxyCommand ssh -q -W %h:%p jump-box
Remote Explorer
Install JDK and Eclipse
For Windows
Download Java JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html and install. Note that JDK contains JRE. Modify the following environment variables:
- add JAVAHOME D:\Program Files (x86)\Java\jdk1.7.051
- add Path %JAVA_HOME%\bin;\%JAVA_HOME%\jre\bin;
- add CLASSPATH %JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\jre\lib\rt.jar
Download Eclipse from http://www.eclipse.org/downloads/ and click eclipse.exe
For Linux
Install JDK
1
2
3
4sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update // depending on the needed java version
sudo apt-get install openjdk-7-jdk
or sudo apt-get install openjdk-8-jre openjdk-8-jdkDownload Eclipse and unpack
Create a new file eclipse.desktop in /usr/share/applications/ and add the below code
1
2
3
4
5
6
7
8[Desktop Entry]
Name=Eclipse
Comment=Eclipse IDE
Exec=/home/liniu/Program_Files/Eclipse/eclipse/eclipse
Icon=/home/ivan/Eclipse/icon.xpm
Categories=Application;Development;Java;IDE
Type=Application
Terminal=0and then run
1
sudo desktop-file-install /usr/share/applications/eclipse.desktop
Add to the path:
sudo ln -s /opt/eclipse/eclipse /usr/local/bin/
Ubuntu MATLAB
- install by running the sh file
- refer to the crack folder
- After installation, create a shortcut
a) sudo ln -s /usr/local/MATLAB/R2012a/bin/matlab /usr/bin/matlab
b) copy the matlab.desktop to /usr/share/applications and matlab.png to /usr/share/icons.
Problem:
/tmp/mathworks……. permission denied
1
2$cd /Matlab.R2012a.UNIX/sys/java/jre/glnxa64/jre/bin
chmod +x ./javawarning: usr/local/MATLAB/R2012a/bin/util/oscheck.sh: /lib/libc.so.6: not found
1
sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64/libc.so.6
Medical Image Format
Format
- DICOM: (Digital Imaging and COmmunications in Medicine) meta info + raw data
- nrrd: meta info (e.g., sizes, dimension, encoding, endian) + raw data
The meta info in nrrd
mainly consists of the format of raw data while the meta info in DICOM
contains the detailed information of patient, study, and series.
There exist matlab and python functions to read DICOM and nrdd files.
- MATLAB
- DICOM: dicominfo, dicomread
- nrrd: nrrdread
- conversion from DICOM to nrrd: Dicom2nrrd
DICOM is generally a directory containing a sequence of slices while nrrd is a single file. The meta info of DICOM is more complicated and thus more error-prone than that of nrrd. Use DICOMPatcher to fix up DICOM files if errors occur when loading them to 3D Slicer.
Software
3D Slicer: cross-platform, compatible with different formats (e.g., DICOM and nrrd), and convert between them.
Other softwares to view medical images: http://www.cabiatl.com/mricro/dicom/#links
MATLAB
run MATLAB using shellscript
1
matlab -nodisplay -r "vid2frames('../data/regular_videos/', 'RiceCam106.MP4', '../data/frames/', '.png');exit"
VideoReader: NumberOfFrames is 0, cannot read frames.
something is wrong with gstreamer, first get the right version of gstreamer (0.10 for MATLAB R2015b)
install gst-plugins
1
2sudo add-apt-repository ppa:ddalex/gstreamer
sudo apt-get install gstreamer0.10-*install gstffmpeg
1
2
3sudo add-apt-repository ppa:mc3man/gstffmpeg-keep
sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
MarkdownPad
Problem: HTML cannot be rendered: the view has crashed awesomium: Awesomium.Windows.Controls.WebControl
solution: Win+R to open regedit: change the following value from 1 to 0
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy\Enabled
Problem: How to suppport Latex: MathJax?
solution: tools > Options > Advanced > HTML Head Editor, add the following:1
2
3<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>After adding the above, a simple example in the MarkDownPad: When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are:
Tips:
- insert image:
<center><img src="http://....jpg" width=50% border="0"></center>
LaTeX
Installation:
Ubuntu
1
2sudo apt-get install texlive-full
sudo apt-get install texmakerWindows
- Install Miktex: https://miktex.org/download
- Install texmaker or texstudio
Extension:
- Latexdiff
- Install perl: http://www.perl.org/get.html
- Download latexdiff.zip package from https://ctan.org/pkg/latexdiff
- Unzip the latexdiff files and copy them to the Perl\perl\bin folder
latexdiff draft.tex revision.tex > diff.tex
Math input:
Include the definition.tex file with macro definition.
\input{definition}
in the main text.Mathpix Snip can convert images to LaTeX.
IguanaTex allows you to insert LaTeX formulations in PowerPoint.
Tips:
Refer to this for commonly used symbols
Set color:
\usepackage{xcolor}
and\textcolor{red}{}
Setlength: set the indentation in paragraphs
\setlength\parindent{0pt}
; set the separation between paragraphs\setlength{\parskip}{10pt}
; set column width in table\setlength{\tabcolsep}{12pt}
; set the space below table/figure\setlength{\textfloatsep}{2pt}
Math annotation: expectation
\usepackage{amsfonts}
and\mathbb{E}
; not imply:\usepackage{amssymb}
and\nRightarrow
Encoding error: try adding
\UseRawInputEncoding
or\usepackage[utf8x]{inputenc}
or\usepackage{newunicodechar}
\newunicodechar{fi}{fi}