OTB  9.0.0
Orfeo Toolbox
otbImageList.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 otbImageList_hxx
22 #define otbImageList_hxx
23 
24 #include "otbImageList.h"
25 #include "otbMacro.h"
26 
27 namespace otb
28 {
29 
30 template <class TImage>
32 {
33  Superclass::UpdateOutputData();
34  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
35  {
36  if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime() || it.Get()->GetDataReleased() || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion())
37  {
38  if (it.Get()->GetSource())
39  {
40  it.Get()->GetSource()->UpdateOutputData(it.Get());
41  }
42  }
43  }
44 }
45 
46 template <class TImage>
48 {
49  Superclass::PropagateRequestedRegion();
50 
51  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
52  {
53  if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime() || it.Get()->GetDataReleased() || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion())
54  {
55 
56  if (it.Get()->GetSource())
57  {
58  it.Get()->GetSource()->PropagateRequestedRegion(it.Get());
59 
60  // Check that the requested region lies within the largest possible region
61  if (!it.Get()->VerifyRequestedRegion())
62  {
63  // invalid requested region, throw an exception
64  itk::InvalidRequestedRegionError e(__FILE__, __LINE__);
65  e.SetLocation(ITK_LOCATION);
66  e.SetDataObject(it.Get());
67  e.SetDescription("Requested region is (at least partially) outside the largest possible region.");
68 
69  throw e;
70  }
71  }
72  }
73  }
74 }
75 
76 template <class TImage>
77 void ImageList<TImage>::SetRequestedRegion(const itk::DataObject* source)
78 {
79  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
80  {
81  it.Get()->SetRequestedRegion(source);
82  }
83 }
84 
85 template <class TImage>
87 {
88  // otbMsgDebugMacro(<<"ImageList: Call to UpdateOutputInformation()");
89  Superclass::UpdateOutputInformation();
90 
91  if (this->GetSource())
92  {
93  this->GetSource()->UpdateOutputInformation();
94  }
95  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
96  {
97  if (it.Get()->GetSource())
98  {
99  it.Get()->GetSource()->UpdateOutputInformation();
100  }
101  }
102 }
103 
104 } // end namespace otb
105 
106 #endif
otbImageList.h
otb::ImageList::ConstIterator
Superclass::ConstIterator ConstIterator
Definition: otbImageList.h:58
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbMacro.h
otb::ImageList::UpdateOutputInformation
void UpdateOutputInformation(void) override
Definition: otbImageList.hxx:86
otb::ImageList::PropagateRequestedRegion
void PropagateRequestedRegion(void) override
Definition: otbImageList.hxx:47
otb::ImageList::UpdateOutputData
void UpdateOutputData(void) override
Definition: otbImageList.hxx:31
otb::ImageList::SetRequestedRegion
void SetRequestedRegion(const itk::DataObject *source) override
Definition: otbImageList.hxx:77