OTB  6.7.0
Orfeo Toolbox
otbSarConcatenateBurstsImageFilter.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbSarConcatenateBurstsImageFilter_hxx
22 #define otbSarConcatenateBurstsImageFilter_hxx
23 
25 #include "itkImageRegionIterator.h"
27 
28 namespace otb
29 {
30 template <class TImage>
31 void
34 {
35  m_SLCImageKWL = sarImageKWL;
36 }
37 
38 template <class TImage>
39 bool
42  unsigned int first_burstInd, bool inputWithInvalidPixels)
43 {
44  // Try to create a SarSensorModelAdapter
46 
47  bool loadOk = sarSensorModel->LoadState(m_SLCImageKWL);
48 
49  if(!loadOk || !sarSensorModel->IsValidSensorModel())
50  itkExceptionMacro(<<"Input image does not contain a valid SAR sensor model.");
51 
53 
54  // Try to call the deburstAndConcatenate function
55  bool deburstAndConcatenateOk = sarSensorModel->DeburstAndConcatenate(linesRecord, samplesRecord,
56  m_Offset_OriginL, first_burstInd,
57  inputWithInvalidPixels);
58 
59  if(!deburstAndConcatenateOk)
60  itkExceptionMacro(<<"Could not deburst or concatenate from input bursts");
61 
62  // Export the new keywordlist
63  bool saveOk = sarSensorModel->SaveState(m_DeburstSLCImageKWL);
64 
65  if(!saveOk)
66  itkExceptionMacro(<<"Could not export deburst SAR sensor model to keyword list");
67 
68  return true;
69 }
70 
71 template <class TImage>
72 void
75 {
76  // First, call superclass implementation
77  Superclass::GenerateOutputInformation();
78 
79  ImageType * outputPtr = this->GetOutput();
80 
81  // Origin to (0.5, 0.5) : Metadata are already adjusted
82  PointType origin;
83  origin[0] = 0.5;
84  origin[1] = 0.5 + m_Offset_OriginL;
85 
86  outputPtr->SetOrigin(origin);
87 
88  // Output KeywordList
89  m_DeburstSLCImageKWL.AddKey("support_data.number_samples", std::to_string(this->GetOutput()->
90  GetLargestPossibleRegion().
91  GetSize()[0]));
92  m_DeburstSLCImageKWL.AddKey("support_data.number_lines", std::to_string(this->GetOutput()->
93  GetLargestPossibleRegion().
94  GetSize()[1]));
95 
96  m_DeburstSLCImageKWL.AddKey("number_samples", std::to_string(this->GetOutput()->
97  GetLargestPossibleRegion().
98  GetSize()[0]));
99  m_DeburstSLCImageKWL.AddKey("number_lines", std::to_string(this->GetOutput()->
100  GetLargestPossibleRegion().
101  GetSize()[1]));
102 
103  // Set new keyword list to output image
104  outputPtr->SetImageKeywordList(m_DeburstSLCImageKWL);
105 }
106 
107 
108 } // end namepsace otb
109 
110 #endif
Storage and conversion for OSSIM metadata.
void SetSLCImageKeyWorList(ImageKeywordlist sarImageKWL)
bool getDeburstLinesAndSamples(LinesRecordVectorType &linesRecord, LinesRecordVectorType &samplesRecord, unsigned int first_burstInd, bool inputWithInvalidPixels)