Skip to content
Snippets Groups Projects
Commit d2799d73 authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

WIP: use a shifted index to manage non zero index when box extended parameter is used

parent d399840f
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,7 @@ public:
typedef typename InputImageType::Pointer InputImagePointer;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename InputImageType::PixelType InputImagePixelType;
typedef typename InputImageType::IndexType InputIndexType;
typedef TInputImage OutputImageType;
typedef typename OutputImageType::Pointer OutputImagePointer;
typedef typename OutputImageType::RegionType OutputImageRegionType;
......@@ -156,19 +157,19 @@ public:
/** Set the only input of the writer */
virtual void SetInput(const InputImageType *input);
/** Get writer only input */
const InputImageType* GetInput();
/** Override Update() from ProcessObject because this filter
* has no output. */
virtual void Update();
/** ImageFileWriter Methods */
virtual void SetFileName(const char* extendedFileName);
virtual void SetFileName(std::string extendedFileName);
virtual const char* GetFileName () const;
/** Specify the region to write. If left NULL, then the whole image
* is written. */
void SetIORegion(const itk::ImageIORegion& region);
......@@ -192,7 +193,7 @@ public:
itkSetObjectMacro(ImageIO, otb::ImageIOBase);
itkGetObjectMacro(ImageIO, otb::ImageIOBase);
itkGetConstObjectMacro(ImageIO, otb::ImageIOBase);
protected:
ImageFileWriter();
virtual ~ImageFileWriter();
......@@ -244,7 +245,7 @@ private:
bool m_UseInputMetaDataDictionary; // whether to use the
// MetaDataDictionary from the
// input or not.
bool m_WriteGeomFile; // Write a geom file to store the
// kwl
......@@ -254,6 +255,7 @@ private:
bool m_IsObserving;
unsigned long m_ObserverID;
InputIndexType m_ShiftOutputIndex;
};
} // end namespace otb
......
......@@ -68,6 +68,9 @@ ImageFileWriter<TInputImage>
m_IsObserving(true),
m_ObserverID(0)
{
//Init output index shift
m_ShiftOutputIndex.Fill(0);
// By default, we use tiled streaming, with automatic tile size
// We don't set any parameter, so the memory size is retrieved from the OTB configuration options
this->SetAutomaticAdaptativeStreaming();
......@@ -494,7 +497,9 @@ ImageFileWriter<TInputImage>
size[1] = atoi(it->c_str()); // size along Y
inputRegion.SetSize(size);
inputRegion.SetIndex(start);
m_ShiftOutputIndex = start;
inputRegion.SetIndex(m_ShiftOutputIndex);
otbMsgDevMacro(<< "inputRegion " << inputRegion);
......@@ -623,7 +628,8 @@ ImageFileWriter<TInputImage>
{
ioRegion.SetSize(i, streamRegion.GetSize(i));
ioRegion.SetIndex(i, streamRegion.GetIndex(i));
//ioRegion.SetIndex(i, streamRegion.GetIndex(i) - inputRegion.GetIndex(i));
//Set the ioRegion index using the shifted index ( (0,0 without box parameter))
ioRegion.SetIndex(i, streamRegion.GetIndex(i) - m_ShiftOutputIndex[i]);
}
otbMsgDevMacro(<< "ioregion " << ioRegion )
this->SetIORegion(ioRegion);
......@@ -711,7 +717,8 @@ ImageFileWriter<TInputImage>
typename InputImageRegionType::IndexType tmpIndex;
tmpIndex.Fill(0);
itk::ImageIORegionAdaptor<TInputImage::ImageDimension>::
Convert(m_ImageIO->GetIORegion(), ioRegion, tmpIndex);
//Convert(m_ImageIO->GetIORegion(), ioRegion, tmpIndex);
Convert(m_ImageIO->GetIORegion(), ioRegion, m_ShiftOutputIndex);
InputImageRegionType bufferedRegion = input->GetBufferedRegion();
// before this test, bad stuff would happend when they don't match
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment