OTB  10.0.0
Orfeo Toolbox
otbSarConcatenateBurstsImageFilter.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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"
26 #include "otbSarSensorModel.h"
27 
28 namespace otb
29 {
30 template <class TImage>
32 {
33  m_SLCImd = sarImd;
34 }
35 
36 template <class TImage>
38  unsigned int first_burstInd, bool inputWithInvalidPixels)
39 {
40  // Try to create a SarSensorModel
41  SarSensorModel sarSensorModel(m_SLCImd);
42 
44 
45  // Try to call the deburstAndConcatenate function
46  bool deburstAndConcatenateOk = sarSensorModel.DeburstAndConcatenate(linesRecord, samplesRecord, m_Offset_OriginL, first_burstInd, inputWithInvalidPixels);
47 
48  if (!deburstAndConcatenateOk)
49  itkExceptionMacro(<< "Could not deburst or concatenate from input bursts");
50 
51  sarSensorModel.UpdateImageMetadata(m_SLCImd);
52 
53  return true;
54 }
55 
56 template <class TImage>
58 {
59  // First, call superclass implementation
60  Superclass::GenerateOutputInformation();
61 
62  auto outputPtr = this->GetOutput();
63 
64  // Origin to (0.5, 0.5) : Metadata are already adjusted
65  PointType origin;
66  origin[0] = 0.5;
67  origin[1] = 0.5 + m_Offset_OriginL;
68 
69  outputPtr->SetOrigin(origin);
70 
71  m_SLCImd.Add(MDNum::NumberOfLines, this->GetOutput()->GetLargestPossibleRegion().GetSize()[0]);
72  m_SLCImd.Add(MDNum::NumberOfColumns, this->GetOutput()->GetLargestPossibleRegion().GetSize()[1]);
73 
74  outputPtr->SetImageMetadata(m_SLCImd);
75 }
76 
77 
78 } // end namespace otb
79 
80 #endif
Generic class containing image metadata used in OTB.
bool getDeburstLinesAndSamples(LinesRecordVectorType &linesRecord, LinesRecordVectorType &samplesRecord, unsigned int first_burstInd, bool inputWithInvalidPixels)
bool DeburstAndConcatenate(std::vector< std::pair< unsigned long, unsigned long > > &linesBursts, std::vector< std::pair< unsigned long, unsigned long > > &samplesBursts, unsigned int &linesOffset, unsigned int first_burstInd, bool inputWithInvalidPixels=false)
void UpdateImageMetadata(ImageMetadata &imd)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.