How to Illustrate Your Work?

Microsoft PowerPoint, or similar presentation tools (Keynote for Mac, Open Office Impress for Linux), are indispensable for scientific illustrations. Many times, the basis for the illustration is some image, Matlab figure, or screenshot that you would like to edit, annotate, or expand. In other cases, you need just to make some simple graphics or schematics.

Start by opening the PowerPoint, and removing everything from the page (CTRL-A to select all, and DEL to delete everything). Load image if needed:

  1. If you want to upload some saved image from the disk, press on the TAB Insert and choose “Picture” from the toolbar. Browse to your image and insert it. You may resize the image by dragging its corners, or to crop it (THE MOST USEFUL FUNCTION – available in all office products) by clicking on “Picture Tools” TAB, and “Crop” button. Pressing this button creates small black dragging bars on the boundaries of the image. You may drag those bars to remove unnecessary parts of the image. You need to click “Crop” button again to finalize cropping. p1By the way, additional multiple picture corrections and style changes are available on the same toolbar. You may play with compression, colors, contrast, brightness, shadows, and various boundaries. Make sure that you are familiar with all of the available options.
  2. To insert Matlab plot or image, go to the Figure menu “Edit”, and choose “Copy Figure” p2Then paste it (CTRL-V) to the PowerPoint. Crop the image (or plot) if needed.
  3. To make a screenshot, just press CTRL-PrntScr, and paste to the PowerPoint. Crop if needed.

If you want to change the order of appearance of images or other objects, you may send them forward or backward by clicking on them and using right-click menu: p3

Now, you could add annotations and additional graphics by using shapes palette: p4

Those shapes could be placed anywhere, resized (using corners dragging), rotated (using small green dot on top of the shape bounding box), combined together (CTRL-left click on all shapes and images that should be combined, right click menu – grouping) and , recolored, and transformed in many other ways (using Drawing Tools toolbar). You have full control over those shapes appearance (by modifying shadows, border color, filling material and color – all of that through Drawing tools toolbar, which appears when some shape is selected. Make sure that you are familiar with all possibilities when working with shapes.

Tip: Many times it is preferable to use MATLAB annotation tools instead of PowerPoint. Those tools are available in MATLAB Insert menu of the Figure window.

To copy your illustration to a Word document, it is a good idea to select and group everything first (CTRL-A, right click -> Group -> Group). Then copy the selected illustration by CTRL-C, and use special paste as a picture in Word. The reason not to use the regular Paste is because it may distort the object sizes due to the limitations of Word document.

p5

Writing Mathematical Formulas in Word Documents

First, you need to install the Mathematics add-in:

Word 2007-2010:
http://www.microsoft.com/en-us/download/details.aspx?id=17786

Word 2013:
http://www.microsoft.com/en-us/download/details.aspx?id=36777

After downloading and installing the add-in, you should see additional Tab in your Word:
p1
 

Pressing on the “Equation” button will open equation editor with many different options and palettes:
p2
 

Make sure that you play enough with this add-in to learn it well. In the homework, you’ll need to write matrices, upper and lower indices, equations, different symbols, Greek letters, etc. If you cannot find some symbol or formula, you could always use hand drawing of any formula by clicking on “Ink Equation”.

For additional information:

Another option is to use MathType:
http://www.dessci.com/en/products/mathtype/

This product is much more comprehensive and convenient to use, though it has two main disadvantages. First, it is not free (discounts are available) and only 30-day trial is available. Second, if you want to change the font size in your document, then you need to reopen every typed formula and to change the font size inside the MathType editor.

Build and install 3D Slicer4 from source code in Windows

The 3D Slicer is a modern biomedical image processing and analysis software based on ITK and VTK libraries. It is an open source, and can be extended with plugins. Developing new modules, though, demands building the Slicer from the source code.

To say the truth, building Slicer in Windows (especially 64 bit Windows) is a pain. The official installation Wiki page is useful, but gives too many variants and options and jumping from one place to another with different prerequisites, prerequisites of prerequisites, etc., and finally forgets to tell you about essential Visual Studio switches. The result is: after a half day of building, you get between 1 to 5 unsuccessful builds…Who knows why…

After endless trials of installing different versions of different prerequisite softwares, here is my first successful installation list (VERY IMPORTANT to use the suggested software versions, and not newer versions):

  1. Install the newest version of Git.
  2. Install the newest version of SilkSVN.
  3. Install QT 4.7.4 (32 bit binary).
  4. Install VS 2008 Express with SP1.
  5. Install the newest version of CMake.
  6. Open the Windows file explorer and create the directory: C:\Slicer4
  7. Go to C:\ root directory, and press right mouse button. Choose Git Bash. When black terminal window opens, write and run:
    svn co http://svn.slicer.org/Slicer4/trunk Slicer4
  8. At this stage, the directory C:\Slicer4 should have all the source code of slicer.
  9. Go to Slicer4 directory, and create there Slicer4-Superbuild directory.
  10. Run CMake-GUI.
  11. Select…Where is the source code: C:\Slicer4
  12. Select…Where to build the binaries: C:\Slicer4\Slicer4-Superbuild
  13. Press Configure and select the generator Visual Studio 9 2008 (NOT Win64). If all the previous softwares were installed and configured properly, this step should run without any error messages, and give you a few selected red-background lines in the upper part of the GUI. If errors occur, this is probably because the system’s PATH is not updated properly (all binaries of all aforementioned programs should be included in the PATH variable.
  14. Press Configure once or twice until all the red disappears.
  15. Press Generate, and close CMake after the successful solution generation.
  16. Go to C:\Slicer4\Slicer4-Superbuild directory and open Slicer.sln with VS2008.
  17. When the project opens, select “Release” option instead of “Debug” on the upper toolbar (important!). Note that the built solution should be Win32 even when compiled on x64 machine and Win64.
  18. Build the solution. Hopefully, after a few hours of compiling, this should create a workable version of Slicer.

Troubleshooting:

  • Once I’ve receive error for NUMPY build, and it was resolved by manually creating an empty NUMPY directory in the Slicer4-Superbuild directory, and recompiling.

Install and Configure OpenCV2 in VS2010

OpenCV is a very useful C++ Computer Vision library. Since the pre-built superpack is available, and can be downloaded from here, the installation is rather simple. The problems begin when you’re trying to find different include/lib/bin directories and define them in Visual studio 2010.

  1. Download the latest version of the Superpack.
  2. Run the EXE file, and extract all the files to some directory, e.g., C:\OpenCV23
  3.  Find the subdirectory “build” inside your OpenCV directory. In this subdirectory, find the directory “bin” which is appropriate for your operational system and compiler, e.g., for 32bit VS2010: C:\OpenCV23\opencv\build\x86\vc10\bin
  4. Now you have to add some environmental variables. The instructions can be found here. Add the full path to the “bin” directory to the PATH variable.
  5. Add the variable: OpenCV_VER = 231     (where 231 is the full version number of your OpenCV (i.e., 2.3.1), without dots)
  6. Add the variable: OpenCV_PATH = C:\OpenCV23\opencv\build   (where the path should point to your “build” directory)
  7. Now, create the text file OpenCV_Debug.props:

<!–?xml version=”1.0″ encoding=”utf-8″?>
<Project ToolsVersion=”4.0″ xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″&gt;
<ImportGroup Label=”PropertySheets” />
<PropertyGroup Label=”UserMacros” />
<PropertyGroup>
<IncludePath>$(OpenCV_PATH)\include;$(IncludePath)
</PropertyGroup>
<PropertyGroup>
<LibraryPath>$(OpenCV_PATH)\x86\vc10\lib;$(LibraryPath)
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>opencv_core$(OpenCV_VER)d.lib;opencv_highgui$(OpenCV_VER)d.lib;opencv_imgproc$(OpenCV_VER)d.lib;opencv_features2d$(OpenCV_VER)d.lib;opencv_calib3d$(OpenCV_VER)d.lib;opencv_video$(OpenCV_VER)d.lib;opencv_objdetect$(OpenCV_VER)d.lib;%(AdditionalDependencies)
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

and the file OpenCV_Release.props:

<!–?xml version=”1.0″ encoding=”utf-8″?>
<Project ToolsVersion=”4.0″ xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″&gt;
<ImportGroup Label=”PropertySheets” />
<PropertyGroup Label=”UserMacros” />
<PropertyGroup>
$(OpenCV_PATH)\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;
</PropertyGroup>
<PropertyGroup>
$(OpenCV_PATH)\x86\vc10\lib;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>opencv_core$(OpenCV_VER).lib;opencv_highgui$(OpenCV_VER).lib;opencv_imgproc$(OpenCV_VER).lib;opencv_features2d$(OpenCV_VER).lib;opencv_calib3d$(OpenCV_VER).lib;opencv_video$(OpenCV_VER).lib;opencv_objdetect$(OpenCV_VER).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

8.   Create an empty Visual Studio console project.

9.  Add some new source file, like main.cpp

10. Copy the prop files you’ve created to the same directory.

11. In the property editor of VS (look for the property tab under the “Solution explorer” window) add the OpenCV_Debug.props property sheet to Debug | Win32, and OpenCV_Release.props to Release | Win32 (by clicking on + button).

That’s it.

Now, if you need to create a new OpenCV project, you should repeat the steps 8-11 only.

If you’d like to update your OpenCV installation to a new version, you should repeat the steps 4-6, and 8-11 only.

Install Python From the Source Code

Python logo

Image via Wikipedia

Installing Python in Windows 7 is simple, because a pre-built  Windows installer exists. The problem begins when you are trying to compile another Python based libraries, which are asking for e.g. python27_d.lib file. This file is absent, thus you have to build the Python source files from scratch. Python distribution includes SLN files for Visual Studio, but if you try to run them, you’ll get errors. The official explanations of the installation process in Windows … well, I can’t understand from there what to do with the errors.

Still, there is a simple enough solution:

  1. Install VS2008. This will not work for other versions.
  2. Install the Netwide Assembler: www.nasm.us , click on “DOWNLOAD” link, choose the latest stable version directory (not rc), click on “win32” directory, download and run the installer (e.g., http://www.nasm.us/pub/nasm/releasebuilds/2.09.10/win32/nasm-2.09.10-installer.exe). The program should be installed to C:\Program Files\NASM.
  3. Go to C:\Program Files\NASM\ and  rename the file nasm.exe to nasmw.exe.
  4. Install Cygwin from cygwin.com: Choose all default settings, except the addition of the following packages:
    1. curl
    2. cvs
    3. git
    4. subversion
    5. tcltk
    6. unzip
    7. zip
  5. Add to the PATH the directories C:\Program Files\NASM\ and C:\cygwin\bin: go to Control Panel, start searching for env…and choose “Edit the system environment variables” –>Environment Variables…–>Edit PATH variable.
  6. Download the Python source code from python.org site: e.g.  http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
  7. Create directory: C:\Python27 and copy all the source files and sub-directories there. If everything is okay, you should see the directory C:\Python27\PCbuild.
  8. Run cmd as administrator: Start button–>All Programs–>Accessories–>Right click on Command Prompt–>Run as Administrator.
  9. In the open terminal write the following:
    1. cd C:\Python27
    2. .\tools\buildbot\build
  10. The Debug version of Python should be installed without errors.

Wikis Comparison

I’ve decided to put my knowledge on the web. The best tool for that it’s wiki with all its inter/hyperlinks, categorization, and bread-crumbs. To find which wiki is right for me I’ve tried different wikis. Most of them are good for some specific purposes, others are just terrible and I don’t understand why are they still alive. Anyway, for my scientific purposes, I need the following.

Continue reading

My Favorite Productivity Tools

Summarization of my favorite productivity software tools to manage papers, books, and knowledge in general.

Continue reading

Software for Knowledge Management

Each day we get an overwhelming amount of information. Web surfing, books, scientific papers are all the sources of new data. To keep up with all these data, we need to use some software. Unfortunately, there is no a single software that will keep all our knowledge, with fast and simple editing tools, and that will be able to search/remind/find answers to our questions. Also, not all softwares are able to keep math formulas (see the following discussion).

The main question here is how we remember things…How can I find something that I (or somebody else) had inserted in some knowledge database, if I don’t know/remember if it exists at all?

Continue reading

Comparison of Mathematical Add-ins for Wikis and Onenote

The math formulas should be easily included in blogs, or knowledge databases, but, unfortunately, most HTML and proprietary formats do not support math. These math tools should be included as add-ins. Each add-in has its own pros and cons, and I want to compare those from my perspective. Since I work with Latex, I’d like the formulas to be converted easily to Latex, or written in Latex. The formulas should be convertible to one of MathType formats. I also prefer WYSIWYG type of inserting formulas.

Continue reading