The way to display scale bars shown here is nice, but can be a bit cumbersome if the images are not that easy, e.g. the image shows a skewed sample in 3D. Everything shown below could also be done completely by hand, but it's quite a boring task to calculate multiple rules of three for every image you want to add a scale bar. I've written a small MATLAB-script to facilitate the calculation and addition to LaTeX.
Both files are explained in a bit more detail at the end of this page, for now I'll just walk you through:
The preamble is nothing too fancy
\documentclass{article} \usepackage{tikz} % used for actually drawing the scale bar \usepackage[ansinew]{inputenc} % is used so I can write my name without too much hassle \usepackage{siunitx} % excellent package to correctly typeset units \usepackage{hyperref} % used for URLs
The block below is used to start the document and to set up the image
\begin{document} \author{David Haberthür} \title{David Haberthür's Head - Scalebar} \date{\today} \maketitle \begin{figure}[h] \centering
Inside here you'll copy the result from the MATLAB-skript, the rest ist just to finish off the document.
\caption{Three dimensional visualization of David Haberthürs Head, released under a \href{http://creativecommons.org/licenses/by/2.0/deed.en_GB}{creative commons Attribution 2.0 Generic license} by the owner of the head.} \label{fig:head} \end{figure} \end{document}
The block below asks the user to select an image-file that is then subsequently used for calculations
[ filename, pathname] = ... uigetfile({'*.jpg;*.tif;*.png;*.gif','All Image Files';... '*.*','All Files' },'Choose Input Image'); image=imread([pathname filesep filename]);
The scale bar is defined by asking the user to click on the image for a start- and end-point.
h = helpdlg('choose start-point of scale bar','ScaleBar'); uiwait(h); [ x1,y1 ] = ginput(1);
the rest is just simple, but boring calculations and semi-nice output, which takes care of setting up the necessary lengths for TikZ.
TikZ: http://kogs-www.informatik.uni-hamburg.de/~meine/tikz/
MATLAB: http://blinkdagger.com/matlab/matlab-querying-the-user-for-input