OTB  6.7.0
Orfeo Toolbox
otbImageList.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 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>
31 void
34 {
35  Superclass::UpdateOutputData();
36  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
37  {
38  if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime()
39  || it.Get()->GetDataReleased()
40  || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion())
41  {
42  if(it.Get()->GetSource())
43  {
44  it.Get()->GetSource()->UpdateOutputData(it.Get());
45  }
46  }
47  }
48 }
49 
50 template <class TImage>
51 void
53 ::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError)
54  {
55  Superclass::PropagateRequestedRegion();
56 
57  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
58  {
59  if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime()
60  || it.Get()->GetDataReleased()
61  || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion())
62  {
63 
64  if (it.Get()->GetSource())
65  {
66  it.Get()->GetSource()->PropagateRequestedRegion(it.Get());
67 
68  // Check that the requested region lies within the largest possible region
69  if (!it.Get()->VerifyRequestedRegion())
70  {
71  // invalid requested region, throw an exception
72  itk::InvalidRequestedRegionError e(__FILE__, __LINE__);
73  e.SetLocation(ITK_LOCATION);
74  e.SetDataObject(it.Get());
75  e.SetDescription("Requested region is (at least partially) outside the largest possible region.");
76 
77  throw e;
78  }
79  }
80  }
81  }
82  }
83 
84 template<class TImage>
85 void
88 {
89  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
90  {
91  it.Get()->SetRequestedRegion(source);
92  }
93 }
94 
95 template <class TImage>
96 void
99 {
100 // otbMsgDebugMacro(<<"ImageList: Call to UpdateOutputInformation()");
101  Superclass::UpdateOutputInformation();
102 
103  if (this->GetSource())
104  {
105  this->GetSource()->UpdateOutputInformation();
106  }
107  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
108  {
109  if (it.Get()->GetSource())
110  {
111  it.Get()->GetSource()->UpdateOutputInformation();
112  }
113  }
114 }
115 
116 } // end namespace otb
117 
118 #endif
void SetDataObject(DataObject *dobj)
virtual void SetDescription(const std::string &s)
virtual void SetLocation(const std::string &s)
void UpdateOutputInformation(void) override
void UpdateOutputData(void) override
void SetRequestedRegion(const itk::DataObject *source) override
void PropagateRequestedRegion(void) override
Superclass::ConstIterator ConstIterator
Definition: otbImageList.h:59