SMIL 1.1.2
Loading...
Searching...
No Matches
Operations on image channels

Detailed Description

+ Collaboration diagram for Operations on image channels:

Functions

template<class MCT1 , class T2 >
RES_T copyChannel (const Image< MCT1 > &imIn, const UINT &chanNum, Image< T2 > &imOut)
 copyChannel() - Copy a channel of multichannel image into a single channel image
 
template<class T1 , class MCT2 >
RES_T copyToChannel (const Image< T1 > &imIn, const UINT &chanNum, Image< MCT2 > &imOut)
 copyToChannel() - Copy a single channel image into a channel of multichannel image
 
template<class MCT1 , class T2 >
RES_T splitChannels (const Image< MCT1 > &imIn, Image< T2 > &im3DOut)
 splitChannels() - Split channels of multichannel image to a 3D image with each channel on a Z slice
 
template<class T1 , class MCT2 >
RES_T mergeChannels (const Image< T1 > &imIn, Image< MCT2 > &imOut)
 mergeChannels() - Merge slices of a 3D image into a multichannel image
 

Function Documentation

◆ copyChannel()

template<class MCT1 , class T2 >
RES_T copyChannel ( const Image< MCT1 > &  imIn,
const UINT &  chanNum,
Image< T2 > &  imOut 
)

copyChannel() - Copy a channel of multichannel image into a single channel image

Parameters
[in]imIn: input image
[in]chanNum: channel in the input image to copy
[out]imOut: output image
Note
  • imIn et imOut are 2D images
  • imOut shall be a previosly allocated single channel image with the same size than imIn.
  • chanNum shall be a valid channel of imIn.

Example

from smilPython import *
# Load a RGB image
im1 = Image("https://smil.cmm.minesparis.psl.eu/images/arearea.png")
im1.show()
# Copy the green channel into a UINT8 image
im2 = Image()
copyChannel(im1, 1, im2)
im2.show()
# Split RGB channels into a 3D UINT8 image with 3 slices (one for each channel)
im3 = Image()
splitChannels(im1, im3)
im3.show()
# Perform a 2D dilation on the slices
im4 = Image(im3)
dilate(im3, im4)
im4.show()
# And merge the result into a RGB image
im5 = Image(im1)
mergeChannels(im4, im5)
im5.show()

◆ copyToChannel()

template<class T1 , class MCT2 >
RES_T copyToChannel ( const Image< T1 > &  imIn,
const UINT &  chanNum,
Image< MCT2 > &  imOut 
)

copyToChannel() - Copy a single channel image into a channel of multichannel image

Parameters
[in]imIn: input image
[in]chanNum: channel in the output image to copy
[out]imOut: output image
Note
  • imIn et imOut are 2D images
  • imOut shall be a previosly allocated multichannel image with the same size than imIn.
  • chanNum shall be a valid channel of imOut.

Example

from smilPython import *
# Load a RGB image
im1 = Image("https://smil.cmm.minesparis.psl.eu/images/arearea.png")
im1.show()
# Copy the green channel into a UINT8 image
im2 = Image()
copyChannel(im1, 1, im2)
im2.show()
# Split RGB channels into a 3D UINT8 image with 3 slices (one for each channel)
im3 = Image()
splitChannels(im1, im3)
im3.show()
# Perform a 2D dilation on the slices
im4 = Image(im3)
dilate(im3, im4)
im4.show()
# And merge the result into a RGB image
im5 = Image(im1)
mergeChannels(im4, im5)
im5.show()

◆ splitChannels()

template<class MCT1 , class T2 >
RES_T splitChannels ( const Image< MCT1 > &  imIn,
Image< T2 > &  im3DOut 
)

splitChannels() - Split channels of multichannel image to a 3D image with each channel on a Z slice

Parameters
[in]imIn: input image
[out]im3DOut: output image
Note
  • imIn is a 2D image
  • im3DOut whall be a previously allocated image. Its size will be set to the same as imIn, but its depth will be set the the number of channels of imIn.

Example

from smilPython import *
# Load a RGB image
im1 = Image("https://smil.cmm.minesparis.psl.eu/images/arearea.png")
im1.show()
# Copy the green channel into a UINT8 image
im2 = Image()
copyChannel(im1, 1, im2)
im2.show()
# Split RGB channels into a 3D UINT8 image with 3 slices (one for each channel)
im3 = Image()
splitChannels(im1, im3)
im3.show()
# Perform a 2D dilation on the slices
im4 = Image(im3)
dilate(im3, im4)
im4.show()
# And merge the result into a RGB image
im5 = Image(im1)
mergeChannels(im4, im5)
im5.show()

◆ mergeChannels()

template<class T1 , class MCT2 >
RES_T mergeChannels ( const Image< T1 > &  imIn,
Image< MCT2 > &  imOut 
)

mergeChannels() - Merge slices of a 3D image into a multichannel image

This function has the inverse behaviour of function splitChannels()

Parameters
[in]imIn: input image
[out]imOut: output image

Example

from smilPython import *
# Load a RGB image
im1 = Image("https://smil.cmm.minesparis.psl.eu/images/arearea.png")
im1.show()
# Copy the green channel into a UINT8 image
im2 = Image()
copyChannel(im1, 1, im2)
im2.show()
# Split RGB channels into a 3D UINT8 image with 3 slices (one for each channel)
im3 = Image()
splitChannels(im1, im3)
im3.show()
# Perform a 2D dilation on the slices
im4 = Image(im3)
dilate(im3, im4)
im4.show()
# And merge the result into a RGB image
im5 = Image(im1)
mergeChannels(im4, im5)
im5.show()