Commit 928adeaf authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: #1534: support cases where input largest doesn't start at (0,0)

parent 8e770af9
......@@ -468,7 +468,6 @@ ImageFileWriter<TInputImage>
*/
inputPtr->UpdateOutputInformation();
InputImageRegionType inputRegion = inputPtr->GetLargestPossibleRegion();
typename TInputImage::PointType origin = inputPtr->GetOrigin();
/** Parse region size modes */
if(m_FilenameHelper->BoxIsSet())
......@@ -485,9 +484,7 @@ ImageFileWriter<TInputImage>
size[0] = boxVector[2]; // size along X
size[1] = boxVector[3]; // size along Y
inputRegion.SetSize(size);
m_ShiftOutputIndex = start;
inputRegion.SetIndex(m_ShiftOutputIndex);
inputRegion.SetIndex(start);
if (!inputRegion.Crop(inputPtr->GetLargestPossibleRegion()))
{
......@@ -501,11 +498,9 @@ ImageFileWriter<TInputImage>
e.SetDataObject(inputPtr);
throw e;
}
inputPtr->TransformIndexToPhysicalPoint(inputRegion.GetIndex(), origin);
otbLogMacro(Info,<<"Writing user defined region ["<<start[0]<<", "<<start[0]+size[0]-1<<"]x["<<start[1]<<", "<<start[1]+size[1]<<"]");
}
m_ShiftOutputIndex = inputRegion.GetIndex();
/**
* Determine of number of pieces to divide the input. This will be the
......@@ -544,6 +539,8 @@ ImageFileWriter<TInputImage>
//
// Setup the ImageIO with information from inputPtr
//
typename TInputImage::PointType origin;
inputPtr->TransformIndexToPhysicalPoint(inputRegion.GetIndex(), origin);
const typename TInputImage::SpacingType& spacing = inputPtr->GetSpacing();
const typename TInputImage::DirectionType& direction = inputPtr->GetDirection();
m_ImageIO->SetNumberOfDimensions(TInputImage::ImageDimension);
......@@ -665,7 +662,7 @@ ImageFileWriter<TInputImage>
//Reset global shift on input region (box parameter)
//It allows calling multiple update over the writer
m_ShiftOutputIndex.Fill(0);
m_ShiftOutputIndex = inputPtr->GetLargestPossibleRegion().GetIndex();
}
......@@ -721,10 +718,7 @@ ImageFileWriter<TInputImage>
InputImageRegionType ioRegion;
// No shift of the ioRegion from the buffered region is expected
typename InputImageRegionType::IndexType tmpIndex;
tmpIndex.Fill(0);
itk::ImageIORegionAdaptor<TInputImage::ImageDimension>::
//Convert(m_ImageIO->GetIORegion(), ioRegion, tmpIndex);
Convert(m_ImageIO->GetIORegion(), ioRegion, m_ShiftOutputIndex);
InputImageRegionType bufferedRegion = input->GetBufferedRegion();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment