Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sébastien Peillet
otb
Commits
8e770af9
Commit
8e770af9
authored
7 years ago
by
remi cresson
Browse files
Options
Downloads
Plain Diff
Merge branch 'bugfix_writer_box' into develop
parents
b0193e0e
e30efff6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/IO/ImageIO/include/otbImageFileWriter.txx
+11
-10
11 additions, 10 deletions
Modules/IO/ImageIO/include/otbImageFileWriter.txx
Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx
+11
-7
11 additions, 7 deletions
...MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx
with
22 additions
and
17 deletions
Modules/IO/ImageIO/include/otbImageFileWriter.txx
+
11
−
10
View file @
8e770af9
...
...
@@ -468,22 +468,22 @@ ImageFileWriter<TInputImage>
*/
inputPtr->UpdateOutputInformation();
InputImageRegionType inputRegion = inputPtr->GetLargestPossibleRegion();
typename TInputImage::PointType origin = inputPtr->GetOrigin();
/** Parse region size modes */
if(m_FilenameHelper->BoxIsSet())
{
std::vector<int> boxVector;
Utils::ConvertStringToVector(
m_FilenameHelper->GetBox(), boxVector, "ExtendedFileName:box", ":");
typename InputImageRegionType::IndexType start;
std::vector<int> boxVector;
Utils::ConvertStringToVector(
m_FilenameHelper->GetBox(), boxVector, "ExtendedFileName:box", ":");
typename InputImageRegionType::IndexType start;
typename InputImageRegionType::SizeType size;
start[0] = boxVector[0]; // first index on X
start[1] = boxVector[1]; // first index on Y
size[0] = boxVector[2]; // size along X
size[1] = boxVector[3]; // size along Y
inputRegion.SetSize(size);
m_ShiftOutputIndex = start;
...
...
@@ -501,6 +501,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]<<"]");
}
...
...
@@ -541,10 +544,9 @@ ImageFileWriter<TInputImage>
//
// Setup the ImageIO with information from inputPtr
//
m_ImageIO->SetNumberOfDimensions(TInputImage::ImageDimension);
const typename TInputImage::SpacingType& spacing = inputPtr->GetSpacing();
const typename TInputImage::PointType& origin = inputPtr->GetOrigin();
const typename TInputImage::DirectionType& direction = inputPtr->GetDirection();
m_ImageIO->SetNumberOfDimensions(TInputImage::ImageDimension);
int direction_sign(0);
for (unsigned int i = 0; i < TInputImage::ImageDimension; ++i)
{
...
...
@@ -555,7 +557,7 @@ ImageFileWriter<TInputImage>
// Final image size
m_ImageIO->SetDimensions(i, inputRegion.GetSize(i));
m_ImageIO->SetSpacing(i, direction_sign * spacing[i]);
m_ImageIO->SetOrigin(i, origin[i]
+ static_cast<double>(inputRegion.GetIndex()[i]) * spacing[i]
);
m_ImageIO->SetOrigin(i, origin[i]);
vnl_vector<double> axisDirection(TInputImage::ImageDimension);
// Please note: direction cosines are stored as columns of the
...
...
@@ -618,7 +620,6 @@ ImageFileWriter<TInputImage>
for (unsigned int i = 0; i < TInputImage::ImageDimension; ++i)
{
ioRegion.SetSize(i, streamRegion.GetSize(i));
ioRegion.SetIndex(i, streamRegion.GetIndex(i));
//Set the ioRegion index using the shifted index ( (0,0 without box parameter))
ioRegion.SetIndex(i, streamRegion.GetIndex(i) - m_ShiftOutputIndex[i]);
}
...
...
This diff is collapsed.
Click to expand it.
Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx
+
11
−
7
View file @
8e770af9
...
...
@@ -458,6 +458,7 @@ SimpleParallelTiffWriter<TInputImage>
*/
inputPtr->UpdateOutputInformation();
InputImageRegionType inputRegion = inputPtr->GetLargestPossibleRegion();
typename InputImageType::PointType origin = inputPtr->GetOrigin();
/** Parse region size modes */
if(m_FilenameHelper->BoxIsSet())
...
...
@@ -497,6 +498,9 @@ SimpleParallelTiffWriter<TInputImage>
throw e;
}
otbMsgDevMacro(<< "inputRegion " << inputRegion);
// Update the origin
inputPtr->TransformIndexToPhysicalPoint(inputRegion.GetIndex(), origin);
}
// Get number of bands & pixel data type
...
...
@@ -538,7 +542,7 @@ SimpleParallelTiffWriter<TInputImage>
else
{
// When mode is not tiled (i.e. striped)
block_size_x = input
Ptr->GetLargestPossible
Region
()
.GetSize()[0];
block_size_x = inputRegion.GetSize()[0];
}
// Master process (Rank 0) is responsible for the creation of the output raster.
...
...
@@ -546,10 +550,10 @@ SimpleParallelTiffWriter<TInputImage>
{
// Set geotransform
double geotransform[6];
geotransform[0] =
inputPtr->GetO
rigin
()
[0] - 0.5*inputPtr->GetSignedSpacing()[0];
geotransform[0] =
o
rigin[0] - 0.5*inputPtr->GetSignedSpacing()[0];
geotransform[1] = inputPtr->GetSignedSpacing()[0];
geotransform[2] = 0.0;
geotransform[3] =
inputPtr->GetO
rigin
()
[1] - 0.5*inputPtr->GetSignedSpacing()[1];
geotransform[3] =
o
rigin[1] - 0.5*inputPtr->GetSignedSpacing()[1];
geotransform[4] = 0.0;
geotransform[5] = inputPtr->GetSignedSpacing()[1];
...
...
@@ -557,8 +561,8 @@ SimpleParallelTiffWriter<TInputImage>
if(!m_TiffTiledMode)
{
SPTW_ERROR sperr = sptw::create_raster(m_FileName,
input
Ptr->GetLargestPossible
Region
()
.GetSize()[0],
input
Ptr->GetLargestPossible
Region
()
.GetSize()[1],
inputRegion.GetSize()[0],
inputRegion.GetSize()[1],
nBands,
dataType,
geotransform,
...
...
@@ -573,8 +577,8 @@ SimpleParallelTiffWriter<TInputImage>
else
{
SPTW_ERROR sperr = sptw::create_tiled_raster(m_FileName,
input
Ptr->GetLargestPossible
Region
()
.GetSize()[0],
input
Ptr->GetLargestPossible
Region
()
.GetSize()[1],
inputRegion.GetSize()[0],
inputRegion.GetSize()[1],
nBands,
dataType,
geotransform,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment