[Insight-users] Superimposing images

Miller, James V (Research) millerjv at crd.ge.com
Sat Sep 10 08:48:03 EDT 2005


Chris, 

The ComposeRGBImageFilter should do what you want.  It takes three scalar
images and generates an RGB image.

You could also use the JoinImageFilter to two images into a 
single image with multiple components.  

Jim


-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Chris Farmer
Sent: Friday, September 09, 2005 8:18 PM
To: insight-users at itk.org
Subject: [Insight-users] Superimposing images



Hi all,

I clearly have a problem with terminology, so if someone could suggest
the proper terms here, I'd really appreciate it!

I have a collection of three images that need to be superimposed on one
another.  They're all grayscale at the moment, but I'd like to use them
as the R, G, and B in a composite RGB image.  I guess I can use a cast
filter to convert my grayscale image into RGB, but I'm not sure how to
then modify the colors.

On a related note, I thought I'd use the AddImageFilter to combine them.
I can't seem to compile when I use an input pixel type of
RGBPixel<unsigned char> when I use the AddImageFilter, though.  When I
use a pixel type of unsigned char, the image addition appears to work
nicely, but it's of course just grayscale.

Here's what I tried:

// Won't compile with this first typedef 
typedef itk::RGBPixel<unsigned char>	RGBPixelType;
// Works with this typedef, but no color
//typedef unsigned char	RGBPixelType;
typedef itk::Image< RGBPixelType, 2 >   RGBImageType;

typedef itk::ImageFileReader<RGBImageType> ReaderType2;
ReaderType2::Pointer reader1 = ReaderType2::New();
ReaderType2::Pointer reader2 = ReaderType2::New();

reader1->SetFileName("C:\\redline.PNG");
reader2->SetFileName("C:\\blueline.PNG");

typedef itk::AddImageFilter<RGBImageType, RGBImageType, RGBImageType>
AddType;
AddType::Pointer adder = AddType::New();
adder->SetInput1(reader1->GetOutput());
adder->SetInput2(reader2->GetOutput());
	
typedef itk::ImageFileWriter<RGBImageType> WriterType;
WriterType::Pointer writer = WriterType::New();

writer->SetFileName("c:\\redplusblue.png");
writer->SetInput(adder->GetOutput());
writer->Update();


Can someone point out any good resources on using ITK with RGB images
like this, or at least suggest some better search terms so I can more
precisely research my problem in the list archives?


Thanks,
Chris



_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list