CADI.Common.LogicalTarget
Class CompsConvertUtils

java.lang.Object
  extended by CADI.Common.LogicalTarget.CompsConvertUtils

public class CompsConvertUtils
extends java.lang.Object

This class contains several functions which are useful to convert the identification of the components from an one-dimesion array of integers or booleans to a two-dimension array of integers with ranges of components, and vice-versa.

Version:
1.0 2008/08/09
Author:
Group on Interactive Coding of Images (GICI)

Constructor Summary
CompsConvertUtils()
           
 
Method Summary
static int[][] componentsExpandedToRangeOfComponents(boolean[] comps)
          Changes the representation from the components as an one-dimensional array to a bi-dimensional array of ranges.
static int[][] componentsToRangeOfComponents(int[] comps)
          This method converts the number of components from an one-dimension array structure to a two-dimension array with ranges of components.
static int[][] componentsToRangeOfComponents(int[] comps, int maxComps)
          Deprecated. 
static int[][] joinOverlapedRanges(int[][] compsRanges)
          This method joins overlaped ranges of components.
static int[] rangeOfComponentsToComponents(int[][] rangeOfComps)
          This method converts form a bi-dimensional array with the ranges of components (first and last component) to an one-dimensional array with the number of the components.
static boolean[] rangeOfComponentsToComponentsExpanded(int[][] rangeOfComps, int maxComps)
          This method converts form a bi-dimensional array with the ranges of components (first and last component) to an one-dimensional array with the number of the components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompsConvertUtils

public CompsConvertUtils()
Method Detail

componentsToRangeOfComponents

@Deprecated
public static int[][] componentsToRangeOfComponents(int[] comps,
                                                               int maxComps)
Deprecated. 

This method converts the number of components from an array structure to an array of ranges.

Parameters:
comps - an array with the component number.
maxComps - is the maximum number of components
Returns:
an array of ranges.

componentsToRangeOfComponents

public static int[][] componentsToRangeOfComponents(int[] comps)
This method converts the number of components from an one-dimension array structure to a two-dimension array with ranges of components. This method supposes that the input one-dimensional array has not repeated values. Otherwise, output data could not be obtained or it could be wrong.

Parameters:
comps - an array with the component number.
Returns:
an array of ranges.

rangeOfComponentsToComponents

public static int[] rangeOfComponentsToComponents(int[][] rangeOfComps)
This method converts form a bi-dimensional array with the ranges of components (first and last component) to an one-dimensional array with the number of the components.

Parameters:
rangeOfComps - a bi-dimensional array with the ranges of the components. The first dimension is the index of the range and the second dimension indicates: 0 the first component of the range, and 1 the last component of the range.
Returns:
a one-dimension array with the components.

rangeOfComponentsToComponentsExpanded

public static boolean[] rangeOfComponentsToComponentsExpanded(int[][] rangeOfComps,
                                                              int maxComps)
This method converts form a bi-dimensional array with the ranges of components (first and last component) to an one-dimensional array with the number of the components.

Parameters:
rangeOfComps - a bi-dimensional array with the ranges of the components. The first dimension is the index of the range and the second dimension indicates: 0 the first component of the range, and 1 the last component of the range.
maxComps - is the maximum number of components.
Returns:
a one-dimension array of booleans. If the index is true , it means the component is chosen. Otherwise, it is not chosen.

componentsExpandedToRangeOfComponents

public static int[][] componentsExpandedToRangeOfComponents(boolean[] comps)
Changes the representation from the components as an one-dimensional array to a bi-dimensional array of ranges. The input parameter comps is an one-dimensional with length the maximum image components where the selected components are true.

Parameters:
comps - an one-dimensional array with the indexes of the selected components set to true value.
Returns:
a bi-dimensioal array of component ranges.

joinOverlapedRanges

public static int[][] joinOverlapedRanges(int[][] compsRanges)
This method joins overlaped ranges of components.

Parameters:
compsRanges -
Returns:
a bi-dimension array with the joined range of components.


CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) (contact)