Sim-LIT  2.0
 All Classes Namespaces Files Functions Variables Typedefs
Pixel.h
Go to the documentation of this file.
1 
9 #ifndef CLASS_PIXEL
10 #define CLASS_PIXEL
11 
12 #include "DataType.h"
13 #include <iostream>
14 #include <vector>
15 using namespace std;
16 
17 class Pixel: public DataType
18 {
19 private:
20  int amount_channels;
21  vector<int> channels;
22  double size;
23 
24 public:
25 
26  ~Pixel(){}
27 
28  Pixel(){
33  this->setValid(false);
34  size=1;
35  }
36 
37  Pixel(vector<int> nChannels, int aChannels){
45  amount_channels = aChannels;
46  channels = nChannels;
47  this->setValid(true);
48  size=1;
49  }
50 
51  vector<int> getChannels(){
56  return channels;
57  }
58 
59  void setChannels(vector<int> nChannels){
63  channels = nChannels;
64  }
65 
66  void setAmountChannels(int aChannels){
70  amount_channels = aChannels;
71  }
72 
73  int* getContent(){
78  int* array = (int*)malloc(sizeof(int)*(2+amount_channels));
79  if(this->isValid()){
80  array[0]=0;
81  }
82  else{
83  array[0]=1;
84  }
85  array[1]=amount_channels;
86  for (int i = 0; i < amount_channels; i++)
87  {
88  array[2+i]=channels[i];
89  }
90  return array;
91  }
92 
98  return amount_channels;
99  }
100 
106  int local_max=0;
107  for(int x=0;x<amount_channels;x++){
108  local_max+=channels[x];
109  }
110  return (int)(local_max/amount_channels);
111  }
112 
113  double getSize(){
118  return size*amount_channels;
119  }
120 
121  void setSize(double nsize){
122  size=nsize;
123  }
124 };
125 
126 #endif
void setChannels(vector< int > nChannels)
Definition: Pixel.h:59
Clase que representa un tipo de dato que serĂ¡ paquetizado.
Definition: DataType.h:18
int getAmountChannels()
Definition: Pixel.h:93
Pixel(vector< int > nChannels, int aChannels)
Definition: Pixel.h:37
int getIntensity()
Definition: Pixel.h:101
double getSize()
Definition: Pixel.h:113
vector< int > getChannels()
Definition: Pixel.h:51
void setAmountChannels(int aChannels)
Definition: Pixel.h:66
Clase que representa un Pixel de una imagen.
Definition: Pixel.h:17
Pixel()
Definition: Pixel.h:28
int * getContent()
Definition: Pixel.h:73