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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
David Youssefi
otb
Commits
fe84f723
Commit
fe84f723
authored
12 years ago
by
Manuel Grizonnet
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add identity transform to allow zoom/dezoom with correct output spacing
parent
c0020449
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Applications/Projections/otbRigidTransformResample.cxx
+43
-1
43 additions, 1 deletion
Applications/Projections/otbRigidTransformResample.cxx
with
43 additions
and
1 deletion
Applications/Projections/otbRigidTransformResample.cxx
+
43
−
1
View file @
fe84f723
...
...
@@ -43,6 +43,7 @@ enum
enum
{
Transform_Identity
,
Transform_Translation
,
Transform_Rotation
,
};
...
...
@@ -65,7 +66,7 @@ public:
typedef
itk
::
TranslationTransform
<
double
,
FloatVectorImageType
::
ImageDimension
>
TransformType
;
typedef
otb
::
StreamingResampleImageFilter
<
FloatVectorImageType
,
FloatVectorImageType
,
double
>
ResampleFilterType
;
//
typedef itk::IdentityTransform<double, FloatVectorImageType::ImageDimension> IdentityTransformType;
typedef
itk
::
IdentityTransform
<
double
,
FloatVectorImageType
::
ImageDimension
>
IdentityTransformType
;
typedef
itk
::
ScalableAffineTransform
<
double
,
FloatVectorImageType
::
ImageDimension
>
ScalableTransformType
;
typedef
ScalableTransformType
::
OutputVectorType
OutputVectorType
;
...
...
@@ -104,6 +105,16 @@ private:
AddParameter
(
ParameterType_Choice
,
"transform.type"
,
"Type of transformation"
);
SetParameterDescription
(
"transform.type"
,
"Type of transformation. Available transformations are translation and rotation with scaling factor"
);
AddChoice
(
"transform.type.id"
,
"translation"
);
SetParameterDescription
(
"transform.type.id"
,
"translation"
);
AddParameter
(
ParameterType_Float
,
"transform.type.id.scalex"
,
"The X translation (in physical units)"
);
SetParameterDescription
(
"transform.type.id.scalex"
,
"The translation value along X axis (in physical units)."
);
SetDefaultParameterFloat
(
"transform.type.id.scalex"
,
1.
);
AddParameter
(
ParameterType_Float
,
"transform.type.id.scaley"
,
"The Y translation (in physical units)"
);
SetParameterDescription
(
"transform.type.id.scaley"
,
"The translation value along Y axis (in physical units)"
);
SetDefaultParameterFloat
(
"transform.type.id.scaley"
,
1.
);
AddChoice
(
"transform.type.translation"
,
"translation"
);
SetParameterDescription
(
"transform.type.translation"
,
"translation"
);
...
...
@@ -198,6 +209,37 @@ private:
// Get Transform
switch
(
GetParameterInt
(
"transform.type"
)
)
{
case
Transform_Identity
:
{
IdentityTransformType
::
Pointer
transform
=
IdentityTransformType
::
New
();
// Scale Transform
OutputVectorType
scale
;
scale
[
0
]
=
1.0
/
GetParameterFloat
(
"transform.type.id.scalex"
);
scale
[
1
]
=
1.0
/
GetParameterFloat
(
"transform.type.id.scaley"
);
// Evaluate spacing
FloatVectorImageType
::
SpacingType
spacing
=
inputImage
->
GetSpacing
();
FloatVectorImageType
::
SpacingType
OutputSpacing
;
OutputSpacing
=
spacing
;
//FIXME Find a way to update the output image spacing after resampling
OutputSpacing
[
0
]
=
spacing
[
0
]
*
scale
[
0
];
OutputSpacing
[
1
]
=
spacing
[
1
]
*
scale
[
1
];
m_Resampler
->
SetOutputSpacing
(
OutputSpacing
);
m_Resampler
->
SetTransform
(
transform
);
// Evaluate size
ResampleFilterType
::
SizeType
recomputedSize
;
recomputedSize
[
0
]
=
inputImage
->
GetLargestPossibleRegion
().
GetSize
()[
0
]
/
scale
[
0
];
recomputedSize
[
1
]
=
inputImage
->
GetLargestPossibleRegion
().
GetSize
()[
1
]
/
scale
[
1
];
m_Resampler
->
SetOutputSize
(
recomputedSize
);
otbAppLogINFO
(
<<
"Output image size : "
<<
recomputedSize
);
}
break
;
case
Transform_Translation
:
{
TransformType
::
Pointer
transform
=
TransformType
::
New
();
...
...
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