SMIL 1.1.1
Loading...
Searching...
No Matches

Detailed Description

+ Collaboration diagram for Others functions:

Functions

template<class T >
RES_T mask (const Image< T > &imIn, const Image< T > &imMask, Image< T > &imOut)
 mask() - Image mask
 
template<class T1 , class mapT , class T2 >
RES_T applyLookup (const Image< T1 > &imIn, const mapT &_map, Image< T2 > &imOut, T2 defaultValue=T2(0))
 applyLookup() - Apply a lookup map to a labeled image
 

Function Documentation

◆ mask()

template<class T >
RES_T mask ( const Image< T > &  imIn,
const Image< T > &  imMask,
Image< T > &  imOut 
)

mask() - Image mask

The result is a image where :

  • imOut(x) = (imMask(x) != 0 ? imIn(x) : 0)
Parameters
[in]imIn: input image
[in]imMask: input mask image
[out]imOut: output image

◆ applyLookup()

template<class T1 , class mapT , class T2 >
RES_T applyLookup ( const Image< T1 > &  imIn,
const mapT &  _map,
Image< T2 > &  imOut,
T2  defaultValue = T2(0) 
)

applyLookup() - Apply a lookup map to a labeled image

Converts a labeled image into a labeled image, converting labels based on a lookup map (or dictionary, in python)

Parameters
[in]imIn: labeled input image
[in]_map: lookup map
[out]imOut: output labeled image
[in]defaultValue: values to be assigned when the input value isn't present in the keys of the lookup map (_map)

Example

import smilPython as sp
im = sp.Image("https://smil.cmm.minesparis.psl.eu/images/balls.png")
imLbl1 = sp.Image(im, "UINT16")
imLbl2 = sp.Image(imLbl1)
sp.label(im, imLbl1)
# We can use a Smil Map
# lookup = Map_UINT16_UINT16()
# or directly a python dict
lookup = dict()
lookup[1] = 2
lookup[5] = 3
lookup[2] = 1
sp.applyLookup(imLbl1, lookup, imLbl2)
imLbl1.showLabel()
imLbl2.showLabel()