OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimSICDToDetectedImage.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2010 Radiant Blue Technologies Inc.
3 //
4 // License: See LICENSE.txt file in the top level directory.
5 //
6 // Author: William Watkins
7 //
8 // Description: A brief description of the contents of the file.
9 //
10 //*************************************************************************
11 
16 #include <ossim/base/ossimCommon.h>
17 #include <ossim/base/ossimTrace.h>
18 
20  "ossimSICDToDetectedImage",
22 
25 {
26 }
27 
29 {
30 }
31 
33  const ossimIrect& tileRect, ossim_uint32 resLevel)
34 {
35  ossimRefPtr<ossimImageData> tile = NULL;
36 
38  {
39  tile = theInputConnection->getTile(tileRect, resLevel);
40 
41  if(!tile.valid())
42  {
43  return tile;
44  }
45 
46  if(!isSourceEnabled() ||
47  (tile->getDataObjectStatus()==OSSIM_NULL)||
49  {
50  return tile;
51  }
52 
53  if(!theTile.valid())
54  {
55  allocate();
56  }
57 
58  if(!theTile.valid())
59  {
60  return tile;
61  }
62 
63  theTile->setImageRectangle(tileRect);
64 
65  if (tile->getNumberOfBands() == 2)
66  {
67  switch(tile->getScalarType())
68  {
69  case OSSIM_UINT8: // SICD 8 Bit data is Amplitude and Phase
70  {
72  tile.get());
73  break;
74  }
75  case OSSIM_SINT8:
76  {
78  tile.get());
79  break;
80  }
81  case OSSIM_UINT16: // SICD 16 Bit data is complex
82  {
84  tile.get());
85  break;
86  }
87  case OSSIM_SINT16:
88  {
90  tile.get());
91  break;
92  }
93  case OSSIM_FLOAT32:
94  {
96  tile.get());
97  break;
98  }
99  default:
100  {
101  break;
102  }
103  }
104  theTile->validate();
105  }
106 
107  return theTile;
108  }
109 
110  return theTile;
111 }
112 
113 template<class T>
115 {
116  T* bands[2];
117  T* result = (T*)theTile->getBuf();
118 
119  bands[0] = (T*)tile->getBuf(0);
120  bands[1] = (T*)tile->getBuf(1);
121 
122  ossim_uint32 offset = 0;
123  ossim_uint32 maxIdx = tile->getWidth()*tile->getHeight();
124 
125  for(offset = 0; offset < maxIdx; ++offset)
126  {
127  result[offset] = sqrt((ossim_float64)bands[0][offset]*(ossim_float64)bands[0][offset] + (ossim_float64)bands[1][offset]*(ossim_float64)bands[1][offset]);
128  }
129 
130 }
131 
132 template<class T>
134 {
135  T* bands[2];
136  T* result = (T*)theTile->getBuf();
137 
138  bands[0] = (T*)tile->getBuf(0);
139  bands[1] = (T*)tile->getBuf(1);
140 
141  ossim_uint32 offset = 0;
142  ossim_uint32 maxIdx = tile->getWidth()*tile->getHeight();
143 
144 
145  for(offset = 0; offset < maxIdx; ++offset)
146  {
147  result[offset] = bands[0][offset]; // The SICD spec says 8 bit data is Mag 8 bits and Phase 8 bits (Not complex)
148  }
149 }
150 
151 
153 {
155  theTile = 0;
156 }
157 
159 {
161  {
163  if(theTile.valid())
164  {
165  }
166  if(theTile.valid())
167  {
168  theTile->initialize();
169  }
170  else
171  {
172  theTile = 0;
173  }
174  }
175 }
176 
178 {
179  if(!property)
180  {
181  return;
182  }
183  else
184  {
186  }
187 }
188 
190 {
192 }
193 
194 void ossimSICDToDetectedImage::getPropertyNames(std::vector<ossimString>& propertyNames)const
195 {
197 }
198 
199 
200 
201 
202 
8 bit signed integer
virtual ossim_uint32 getWidth() const
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual ossim_uint32 getNumberOfBands() const
void processComplexTile(T dummy, ossimImageData *tile)
Applies the brightness contrast to tile.
virtual void setImageRectangle(const ossimIrect &rect)
16 bit unsigned integer
RTTI_DEF1(ossimSICDToDetectedImage, "ossimSICDToDetectedImage", ossimImageSourceFilter) ossimSICDToDetectedImage
bool valid() const
Definition: ossimRefPtr.h:75
float ossim_float32
16 bit signed integer
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
void processAmplitudeAngleTile(T dummy, ossimImageData *tile)
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
signed char ossim_sint8
32 bit floating point
unsigned short ossim_uint16
virtual void initialize()
Initialize the data buffer.
ossimSICDToDetectedImage()
Currently works with SICD data but will generally work for conforming Complex formats.
double ossim_float64
static ossimImageDataFactory * instance()
virtual ossimDataObjectStatus validate() const
signed short ossim_sint16
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
ossimImageSource * theInputConnection
unsigned int ossim_uint32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
Applies the sqrt(I^2 + Q^2) to generate the Detected SAR image.
void allocate()
Called to initialize tiles by first get tile when theTile or theNormTile are not initialized.
virtual void initialize()
Calls base ossimImageSourceFilter::initialize() to reset connection if needed then nulls out tiles...
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
virtual ossimScalarType getScalarType() const
virtual const void * getBuf() const
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
8 bit unsigned integer
ossimRefPtr< ossimImageData > theTile
unsigned char ossim_uint8
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)