Friday, August 13, 2010

Medical abbreviation nightmare

In a separate essay, I discussed some of the intricacies of medical abbreviations, and I included a list of so-called "fatal" abbreviations, whose use could actually jeopardize patient care.

Here's another problem abbreviation: NSCLC

NSCLC is the abbreviation for Non-Small Cell Lung Cancer. In itself, this is a very awkward term, because it doesn't stand for a specific type of cancer, but for a group of cancers that happen not to be a specific type of cancer (i.e., not small cell lung cancer).

The two most common types of non-small cell lung cancers are squamous cell lung cancer and adenocarcinoma.

One possible abbreviation for squamous cell lung cancer is SCLC, hence NSCLC could mean, to some people, non squamous cell lung cancer.

The much-preferred abbreviation for squamous cell lung cancer is SCCL (squamous cell carcinoma of lung), which could just as easily be an abbreviation for small cell carcinoma of lung.

But let's pretend that everybody understands how to use these abbreviations, and nobody makes the most common orthographic error encountered, tranliteration, switching the positions of the C and the L (SCCL for SCLC).

There's still the problem of finding a coherent meaning in the term NSCLC. This term was invented because small cell carcinoma of lung has a clinical behaviour and a treatment that is different from all the other tumors of the lung. Small cell carcinoma of the lung, more than any other lung cancer, is likely to metastasize widely, before the primary lung tumor is detected clinically. This means that surgery for small cell carcinoma serves little purpose (because most tumors have have already metastasized at the time of surgery). Early aggressive chemotherapy makes more sense. Hence oncologists have created two major groups of lung cancer: 1) small cell cancer, and 2) everything else.

The problem now is that there are treatment differences among the NSCLCs. For example, bevacizumab (an antibody targeted against vascular endothelial growth factor and used to treat NSCLCs) seems to cause hemoptysis in some patients who have sqamous cell carcinoma of the lung. Hence, bevacizumab is currently recommended only for patients with non-squamous non-small cell carcinoma of lung (note the double negative). Hence, using abbreviations, bevacizumab is used for NSCCL NSCLC.

This illustrates just one more example of the confusing and potentially error-causing abbreviations used in medicine.

- © 2010 Jules Berman

Tuesday, August 3, 2010

Image montage with Perl Ruby Python

On occasion, you might want to create a single image from a list of individual images. The easiest way of making such an image is with ImageMagick.

ImageMagick is a free, open source, image application. Information is available at:

http://www.imagemagick.org/Usage/

If you use Windows, a compiled binary download is available:

Perl, Python, and Ruby each have their own interfaces to ImageMagick.

Today's blog provides equivalent implementations of the ImageMagick montage feature, in three languages.

Perl:

#!/usr/bin/perl
use Image::Magick;
my $image = Image::Magick->new;
my $montage = Image::Magick->new;
my $status = $image -> Read("mach_cov.jpg",
"071.jpg", "072.jpg", "073.jpg", "075.jpg",
"076.jpg", "077.jpg", "079.jpg");
$image -> Scale('200x200');
print STDERR $status;
$montage = $image -> Montage(background => "Blue",
borderwidth => "5", geometry => '+5+5',
tile => "4x2");
$montage -> Write('jpg:orig.jpg');
system("imdisplay orig.jpg");
exit;

Python:

#!/usr/bin/python
import os
os.system("montage mach_cov.jpg \
071.jpg 072.jpg 073.jpg 075.jpg \
076.jpg 077.jpg 079.jpg \
-background #0000ff -geometry 200x200+5+5 \
-borderwidth 5 -tile 4x2 orig.gif")
os.system("imdisplay orig.gif");
exit

The "\" appearing at the end of lines is the DOS command-line continuation character.

Ruby:

#!/usr/local/bin/ruby
require 'RMagick'
include Magick
orig = Magick::ImageList.new(
"mach_cov.jpg", "071.jpg", "072.jpg",
"073.jpg", "075.jpg", "076.jpg",
"077.jpg", "079.jpg")
new_img = orig.montage() {
self.background_color='blue';
self.border_color='red';
self.tile='4x2'
self.geometry='200x200+5+15'
self.border_width=5}
new_img.write("orig.gif")
system("imdisplay orig.gif")
exit

The input images are the 8 book covers that appear on the right hand side of this blog. Obviously, you'll substitute any number of images from your own collection. You'll also need to provide a an appropriate tiling geometry for the number of images you use (I used 4x2, four across and 2 down) for this example.

The output looks like this:


Each of the scripts calls provides the list of images to be included in the output image, and provides the montage method with attributes for the image display (i.e., background collor, image sizes, image border, space between images, tiling geometry).

In the case of the Perl script, the external module Image::Magick is called (available from ActiveState). In the case of Ruby, the RMagick gem is used. Users of these languages should known how to acquire these modules.

In the case of Python, a system call is made to the installed ImageMagick application. I had a little problem getting the Python script to work because the system call to the "montage" executable apparently executed some other program of the same name. This problem was skirted when I simply visited the subdirectory that held the ImageMagick files, and copied the montage.exe file over to the same subdirectory that held my Python script. When the python script was interpreted, the system used the montage.exe file in the same subdirectory as the script.

The montage method is explained in detail on the following web page:

http://www.imagemagick.org/Usage/montage/

Many of the basic algorithms of Medical Informatics, with equivalent implementations in Perl, Python, and Ruby are provided in my book, Methods in Medical Informatics: Fundamentals of Healthcare Programming in Perl, Python, and Ruby, which will be published next month by CRC Press.

- © 2010 Jules J. Berman
tags:image files, perl programming, Python programming, Ruby programming
Science is not a collection of facts. Science is what facts teach us; what we can learn about our universe, and ourselves, by deductive thinking. From observations of the night sky, made without the aid of telescopes, we can deduce that the universe is expanding, that the universe is not infinitely old, and why black holes exist. Without resorting to experimentation or mathematical analysis, we can deduce that gravity is a curvature in space-time, that the particles that compose light have no mass, that there is a theoretical limit to the number of different elements in the universe, and that the earth is billions of years old. Likewise, simple observations on animals tell us much about the migration of continents, the evolutionary relationships among classes of animals, why the nuclei of cells contain our genetic material, why certain animals are long-lived, why the gestation period of humans is 9 months, and why some diseases are rare and other diseases are common. In “Armchair Science”, the reader is confronted with 129 scientific mysteries, in cosmology, particle physics, chemistry, biology, and medicine. Beginning with simple observations, step-by-step analyses guide the reader toward solutions that are sometimes startling, and always entertaining. “Armchair Science” is written for general readers who are curious about science, and who want to sharpen their deductive skills.