FARSIGHT Tutorials/Multi-Component Images
From FarsightWiki
(Difference between revisions)
LuisIbanez (Talk | contribs) (→Basics Concepts) |
LuisIbanez (Talk | contribs) (→ITK Image Types) |
||
Line 28: | Line 28: | ||
This will create an image of 2 dimensions, where every pixel has components represented as "unsigned chars" and therefore encoded in 8-bits. | This will create an image of 2 dimensions, where every pixel has components represented as "unsigned chars" and therefore encoded in 8-bits. | ||
+ | |||
+ | You can then create a reader for this type of images with the command | ||
+ | |||
+ | vreader1 = itk.ImageFileReader[ vimage1 ].New() | ||
+ | vreader1.SetFileName(pathToImages+"/peppers.png") | ||
+ | vreader1.Update() | ||
+ | vimage1 = vreader1.GetOutput() | ||
+ | |||
+ | a more direct way of doing this will be | ||
+ | |||
+ | reader1 = itk.ImageFileReader.VIUC2.New(FileName=pathToImages+"/peppers.png") | ||
+ | image = reader.GetOutput() | ||
+ | itk.write( image, pathToImages+"/peppers2.mhd") | ||
+ | |||
+ | = Extracting one Component = |
Revision as of 14:37, 4 May 2009
Contents |
Details
- Goal: This tutorial is intended to show you how to multi-component (also known as multi-channel) in FARSIGHT
- Duration: 30 minutes
- Requisites: Having completed the tutorial: Quick Start for users of ITK (30 minutes)
- Materials: FARSIGHT Installed
Basics Concepts
Image Nature
- Multi-channel images: are images for which every pixel contains multiple scalar values. They are common in microsocopy as
- RGB color images
- Images acquired with multiple color filters
- Images corresponding to different frequencies of fluorescent proteins
It is common for the number of components in an image to be known only when the image is loaded into memory.
ITK Image Types
The proper type for managing multi-component images is the
itk.VectorImage
You can create an itk.VectorImage with the following Python command
vimage1 = itk.VectorImage[ itk.UC, 2 ].New()
This will create an image of 2 dimensions, where every pixel has components represented as "unsigned chars" and therefore encoded in 8-bits.
You can then create a reader for this type of images with the command
vreader1 = itk.ImageFileReader[ vimage1 ].New() vreader1.SetFileName(pathToImages+"/peppers.png") vreader1.Update() vimage1 = vreader1.GetOutput()
a more direct way of doing this will be
reader1 = itk.ImageFileReader.VIUC2.New(FileName=pathToImages+"/peppers.png") image = reader.GetOutput() itk.write( image, pathToImages+"/peppers2.mhd")