Commit 9b5d6859 authored by Antoine Regimbeau's avatar Antoine Regimbeau

BUG : NOT COMPILING! :result of sed modification for Get and set signed spacing

parent bbdada00
......@@ -114,20 +114,20 @@ int main(int, char *[])
// Software Guide : BeginLatex
//
// The array can be assigned to the image using
// the \code{SetSpacing()} method.
// the \code{SetSignedSpacing()} method.
//
// \index{otb::Image!SetSpacing()}
// \index{otb::Image!SetSignedSpacing()}
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
image->SetSpacing(spacing);
image->SetSignedSpacing(spacing);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// The spacing information can be retrieved from an image by using the
// \code{GetSpacing()} method. This method returns a reference to a
// \code{GetSignedSpacing()} method. This method returns a reference to a
// \code{FixedArray}. The returned object can then be used to read the
// contents of the array. Note the use of the \code{const} keyword to indicate
// that the array will not be modified.
......@@ -135,7 +135,7 @@ int main(int, char *[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
const ImageType::SpacingType& sp = image->GetSpacing();
const ImageType::SpacingType& sp = image->GetSignedSpacing();
std::cout << "Spacing = ";
std::cout << sp[0] << ", " << sp[1] << std::endl;
......
......@@ -99,7 +99,7 @@ int main(int argc, char * argv[])
ImagePointType origin = image->GetOrigin();
ImageType::SpacingType spacing = image->GetSpacing();
ImageType::SpacingType spacing = image->GetSignedSpacing();
ImageType::SizeType size = image->GetBufferedRegion().GetSize();
ImagePointType point;
......
......@@ -374,7 +374,7 @@ int main(int argc, char* argv[])
// Software Guide : BeginCodeSnippet
generator->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin());
generator->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing());
generator->SetOutputSpacing(fixedReader->GetOutput()->GetSignedSpacing());
generator->SetOutputSize(fixedReader->GetOutput()
->GetLargestPossibleRegion().GetSize());
// Software Guide : EndCodeSnippet
......@@ -439,7 +439,7 @@ int main(int argc, char* argv[])
warper->SetInput(movingReader->GetOutput());
warper->SetDisplacementField(generator->GetOutput());
warper->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin());
warper->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing());
warper->SetOutputSpacing(fixedReader->GetOutput()->GetSignedSpacing());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
......@@ -179,7 +179,7 @@ int main(int argc, char * argv[])
vectorDataRenderer->SetSize(reader->GetOutput()->GetLargestPossibleRegion().GetSize());
vectorDataRenderer->SetOrigin(reader->GetOutput()->GetOrigin());
vectorDataRenderer->SetSpacing(reader->GetOutput()->GetSpacing());
vectorDataRenderer->SetSpacing(reader->GetOutput()->GetSignedSpacing());
vectorDataRenderer->SetRenderingStyleType(VectorDataRendererType::Binary);
blendingFilter->SetInput1(reader->GetOutput());
......
......@@ -237,7 +237,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing();
ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing();
ImageType::PointType origin = reader->GetOutput()->GetOrigin();
//OutputImageType::SizeType size = outputImage->GetLargestPossibleRegion().GetSize();
......
......@@ -116,7 +116,7 @@ int main(int itkNotUsed(argc), char* argv[])
// SoftwareGuide: EndLatex
// SoftwareGuide : BeginCodeSnippet
file << "Spacing " << image->GetSpacing() << std::endl;
file << "Spacing " << image->GetSignedSpacing() << std::endl;
file << "Origin " << image->GetOrigin() << std::endl;
file << "Projection REF " << image->GetProjectionRef() << std::endl;
......
......@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
Index4DType index4D = region4D.GetIndex();
Size4DType size4D = region4D.GetSize();
Spacing4DType spacing4D = image4D->GetSpacing();
Spacing4DType spacing4D = image4D->GetSignedSpacing();
Origin4DType origin4D = image4D->GetOrigin();
for (unsigned int i = 0; i < 3; ++i)
......@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
origin3D[i] = origin4D[i];
}
image3D->SetSpacing(spacing3D);
image3D->SetSignedSpacing(spacing3D);
image3D->SetOrigin(origin3D);
Region3DType region3D;
......
......@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
ImageType::Pointer outputImage = ImageType::New();
outputImage->SetRegions(outputRegion);
const ImageType::SpacingType& spacing = reader->GetOutput()->GetSpacing();
const ImageType::SpacingType& spacing = reader->GetOutput()->GetSignedSpacing();
const ImageType::PointType& inputOrigin = reader->GetOutput()->GetOrigin();
double outputOrigin[Dimension];
......@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
outputOrigin[i] = inputOrigin[i] + spacing[i] * inputStart[i];
}
outputImage->SetSpacing(spacing);
outputImage->SetSignedSpacing(spacing);
outputImage->SetOrigin(outputOrigin);
outputImage->Allocate();
// Software Guide : EndCodeSnippet
......
......@@ -321,7 +321,7 @@ int main(int argc, char* argv[])
resampler->SetTransform(estimator->GetAffineTransform());
resampler->SetSize(fixedImage->GetLargestPossibleRegion().GetSize());
resampler->SetOutputOrigin(fixedImage->GetOrigin());
resampler->SetOutputSpacing(fixedImage->GetSpacing());
resampler->SetOutputSpacing(fixedImage->GetSignedSpacing());
resampler->SetDefaultPixelValue(100);
// Software Guide : EndCodeSnippet
......
......@@ -304,7 +304,7 @@ int main(int argc, char* argv[])
// Software Guide : BeginCodeSnippet
ImageType::ConstPointer fixedImage = fixedReader->GetOutput();
deformer->SetOutputSpacing(fixedImage->GetSpacing());
deformer->SetOutputSpacing(fixedImage->GetSignedSpacing());
deformer->SetOutputOrigin(fixedImage->GetOrigin());
deformer->SetOutputRegion(fixedImage->GetLargestPossibleRegion());
// Software Guide : EndCodeSnippet
......
......@@ -234,7 +234,7 @@ int main(int argc, char * argv[])
}
PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin();
ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing();
ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing();
ImageType::PointType origin = reader->GetOutput()->GetOrigin();
OutputImageType::SizeType size =
outputImage->GetLargestPossibleRegion().GetSize();
......
......@@ -239,7 +239,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing();
ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing();
ImageType::PointType origin = reader->GetOutput()->GetOrigin();
// Software Guide : EndCodeSnippet
......
......@@ -129,7 +129,7 @@ int main(int argc, char* argv[])
// necessary for sensors
filter->SetOutputOrigin(imageReader->GetOutput()->GetOrigin());
// necessary for sensors
filter->SetOutputSpacing(imageReader->GetOutput()->GetSpacing());
filter->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing());
// ~ wkt
filter->SetOutputProjectionRef( imageReader->GetOutput()->GetProjectionRef());
// Software Guide : EndCodeSnippet
......
......@@ -93,7 +93,7 @@ int main(int argc, char* argv[])
reader->GenerateOutputInformation();
std::cout << "Original input imagine spacing: " <<
reader->GetOutput()->GetSpacing() << std::endl;
reader->GetOutput()->GetSignedSpacing() << std::endl;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -197,7 +197,7 @@ int main(int argc, char* argv[])
outputImage->SetOrigin(origin);
outputImage->SetRegions(region);
outputImage->SetSpacing(spacing);
outputImage->SetSignedSpacing(spacing);
outputImage->Allocate();
// Software Guide : EndCodeSnippet
......
......@@ -105,13 +105,13 @@ int main(int argc, char* argv[])
TypedRegion::IndexType index;
size[0] = imageReader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]
* imageReader->GetOutput()->GetSpacing()[0];
* imageReader->GetOutput()->GetSignedSpacing()[0];
size[1] = imageReader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]
* imageReader->GetOutput()->GetSpacing()[1];
* imageReader->GetOutput()->GetSignedSpacing()[1];
index[0] = imageReader->GetOutput()->GetOrigin()[0]
- 0.5 * imageReader->GetOutput()->GetSpacing()[0];
- 0.5 * imageReader->GetOutput()->GetSignedSpacing()[0];
index[1] = imageReader->GetOutput()->GetOrigin()[1]
- 0.5 * imageReader->GetOutput()->GetSpacing()[1];
- 0.5 * imageReader->GetOutput()->GetSignedSpacing()[1];
region.SetSize(size);
region.SetOrigin(index);
......
......@@ -143,7 +143,7 @@ int main(int argc, char* argv[])
vectorDataProjection->SetOutputOrigin(
imageReader->GetOutput()->GetOrigin());
vectorDataProjection->SetOutputSpacing(
imageReader->GetOutput()->GetSpacing());
imageReader->GetOutput()->GetSignedSpacing());
vectorDataProjection->SetOutputProjectionRef(
imageReader->GetOutput()->GetProjectionRef());
// Software Guide : EndCodeSnippet
......
......@@ -596,7 +596,7 @@ int main(int argc, char *argv[])
FixedImageType::Pointer fixedImage = fixedImageReader->GetOutput();
resampler->SetSize(fixedImage->GetLargestPossibleRegion().GetSize());
resampler->SetOutputOrigin(fixedImage->GetOrigin());
resampler->SetOutputSpacing(fixedImage->GetSpacing());
resampler->SetOutputSpacing(fixedImage->GetSignedSpacing());
resampler->SetDefaultPixelValue(100);
// Software Guide : EndCodeSnippet
......
......@@ -481,7 +481,7 @@ int main(int argc, char *argv[])
resample->SetSize(fixedImage->GetLargestPossibleRegion().GetSize());
resample->SetOutputOrigin(fixedImage->GetOrigin());
resample->SetOutputSpacing(fixedImage->GetSpacing());
resample->SetOutputSpacing(fixedImage->GetSignedSpacing());
resample->SetDefaultPixelValue(100);
typedef unsigned char OutputPixelType;
......
......@@ -277,7 +277,7 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
FixedImageType::Pointer fixedImage = fixedImageReader->GetOutput();
const SpacingType fixedSpacing = fixedImage->GetSpacing();
const SpacingType fixedSpacing = fixedImage->GetSignedSpacing();
const OriginType fixedOrigin = fixedImage->GetOrigin();
const RegionType fixedRegion = fixedImage->GetLargestPossibleRegion();
const SizeType fixedSize = fixedRegion.GetSize();
......@@ -297,7 +297,7 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
MovingImageType::Pointer movingImage = movingImageReader->GetOutput();
const SpacingType movingSpacing = movingImage->GetSpacing();
const SpacingType movingSpacing = movingImage->GetSignedSpacing();
const OriginType movingOrigin = movingImage->GetOrigin();
const RegionType movingRegion = movingImage->GetLargestPossibleRegion();
const SizeType movingSize = movingRegion.GetSize();
......@@ -528,7 +528,7 @@ int main(int argc, char *argv[])
resample->SetSize(fixedImage->GetLargestPossibleRegion().GetSize());
resample->SetOutputOrigin(fixedImage->GetOrigin());
resample->SetOutputSpacing(fixedImage->GetSpacing());
resample->SetOutputSpacing(fixedImage->GetSignedSpacing());
resample->SetDefaultPixelValue(100);
typedef otb::ImageFileWriter<FixedImageType> WriterFixedType;
......
......@@ -544,7 +544,7 @@ int main(int argc, char *argv[])
resampler->SetSize(fixedImage->GetLargestPossibleRegion().GetSize());
resampler->SetOutputOrigin(fixedImage->GetOrigin());
resampler->SetOutputSpacing(fixedImage->GetSpacing());
resampler->SetOutputSpacing(fixedImage->GetSignedSpacing());
resampler->SetDefaultPixelValue(100);
typedef unsigned char OutputPixelType;
......
......@@ -219,10 +219,10 @@ private:
TransformType::ParametersType params;
params.SetSize(6);
params[0] = inImage->GetSpacing()[0];
params[0] = inImage->GetSignedSpacing()[0];
params[1] = 0;
params[2] = 0;
params[3] = inImage->GetSpacing()[1];
params[3] = inImage->GetSignedSpacing()[1];
params[4] = inImage->GetOrigin()[0];
params[5] = inImage->GetOrigin()[1];
......@@ -250,7 +250,7 @@ private:
vproj->SetOutputKeywordList(inImage->GetImageKeywordlist());
vproj->SetOutputProjectionRef(inImage->GetProjectionRef());
vproj->SetOutputOrigin(inImage->GetOrigin());
vproj->SetOutputSpacing(inImage->GetSpacing());
vproj->SetOutputSpacing(inImage->GetSignedSpacing());
// Setup the DEM Handler
otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
......
......@@ -281,7 +281,7 @@ private:
pprime1 = rsTransform->TransformPoint(point1);
error = vcl_sqrt((point2[0]-pprime1[0])*(point2[0]-pprime1[0])+(point2[1]-pprime1[1])*(point2[1]-pprime1[1]));
if(error>GetParameterFloat("precision")*vcl_sqrt(vcl_abs(im2->GetSpacing()[0]*im2->GetSpacing()[1])))
if(error>GetParameterFloat("precision")*vcl_sqrt(vcl_abs(im2->GetSignedSpacing()[0]*im2->GetSignedSpacing()[1])))
{
filtered = true;
}
......
......@@ -185,7 +185,7 @@ private:
vproj->SetInput(vd);
vproj->SetInputKeywordList(GetParameterImage("in")->GetImageKeywordlist());
//vproj->SetInputOrigin(GetParameterImage("in")->GetOrigin());
//vproj->SetInputSpacing(GetParameterImage("in")->GetSpacing());
//vproj->SetInputSpacing(GetParameterImage("in")->GetSignedSpacing());
// Setup the DEM Handler
otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
......
......@@ -316,8 +316,8 @@ private:
ossOutput << "\tOrigin : [" << GetParameterFloat("originx") << "," << GetParameterFloat("originy") << "]" << std::endl;
//Get image spacing
SetParameterFloat("spacingx",inImage->GetSpacing()[0], false);
SetParameterFloat("spacingy",inImage->GetSpacing()[1], false);
SetParameterFloat("spacingx",inImage->GetSignedSpacing()[0], false);
SetParameterFloat("spacingy",inImage->GetSignedSpacing()[1], false);
ossOutput << "\tSpacing : [" << GetParameterFloat("spacingx") << "," << GetParameterFloat("spacingy") << "]" << std::endl;
//Estimate ground spacing
......
......@@ -533,7 +533,7 @@ private:
FloatVectorImageType::Pointer inOrtho = GetParameterImage("outputs.ortho");
ResampleFilterType::OriginType orig = inOrtho->GetOrigin();
ResampleFilterType::SpacingType spacing = inOrtho->GetSpacing();
ResampleFilterType::SpacingType spacing = inOrtho->GetSignedSpacing();
ResampleFilterType::SizeType size = inOrtho->GetLargestPossibleRegion().GetSize();
SetParameterInt("outputs.sizex",size[0]);
......
......@@ -234,7 +234,7 @@ private:
scale[1] = 1.0 / GetParameterFloat("transform.type.id.scaley");
// Evaluate spacing
FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing();
FloatVectorImageType::SpacingType spacing = inputImage->GetSignedSpacing();
FloatVectorImageType::SpacingType OutputSpacing;
OutputSpacing[0] = spacing[0] * scale[0];
OutputSpacing[1] = spacing[1] * scale[1];
......@@ -279,7 +279,7 @@ private:
scale[1] = 1.0 / GetParameterFloat("transform.type.translation.scaley");
// Evaluate spacing
FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing();
FloatVectorImageType::SpacingType spacing = inputImage->GetSignedSpacing();
FloatVectorImageType::SpacingType OutputSpacing;
OutputSpacing[0] = spacing[0] * scale[0];
OutputSpacing[1] = spacing[1] * scale[1];
......@@ -312,7 +312,7 @@ private:
ScalableTransformType::Pointer transform = ScalableTransformType::New();
FloatVectorImageType::SizeType inSize = inputImage->GetLargestPossibleRegion().GetSize();
FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing();
FloatVectorImageType::SpacingType spacing = inputImage->GetSignedSpacing();
itk::ContinuousIndex<double,2> ULindex(inputImage->GetLargestPossibleRegion().GetIndex());
ULindex[0] += -0.5;
......
......@@ -214,7 +214,7 @@ private:
otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
// Set up output image information
FloatVectorImageType::SpacingType spacing = refImage->GetSpacing();
FloatVectorImageType::SpacingType spacing = refImage->GetSignedSpacing();
FloatVectorImageType::IndexType start = refImage->GetLargestPossibleRegion().GetIndex();
FloatVectorImageType::SizeType size = refImage->GetLargestPossibleRegion().GetSize();
FloatVectorImageType::PointType origin = refImage->GetOrigin();
......@@ -278,7 +278,7 @@ private:
m_BasicResampler->SetOutputOrigin(origin);
FloatVectorImageType::SpacingType xsSpacing = GetParameterImage("inm")->GetSpacing();
FloatVectorImageType::SpacingType xsSpacing = GetParameterImage("inm")->GetSignedSpacing();
xsSpacing*=0.25;
m_BasicResampler->SetOutputSpacing(xsSpacing);
......
......@@ -144,7 +144,7 @@ private:
{
FloatVectorImageType::Pointer inImage = GetParameterFloatVectorImage("in.kwl");
m_GeometriesProjFilter->SetInputOrigin(inImage->GetOrigin()); // nec qd capteur
m_GeometriesProjFilter->SetInputSpacing(inImage->GetSpacing()); // nec qd capteur
m_GeometriesProjFilter->SetInputSpacing(inImage->GetSignedSpacing()); // nec qd capteur
m_GeometriesProjFilter->SetInputKeywordList(inImage->GetImageKeywordlist());
//otbAppLogINFO(<<"kwl."<<std::endl);
}
......@@ -156,7 +156,7 @@ private:
if (outImage)
{
m_GeometriesProjFilter->SetOutputOrigin(outImage->GetOrigin()); // nec qd capteur
m_GeometriesProjFilter->SetOutputSpacing(outImage->GetSpacing()); // nec qd capteur
m_GeometriesProjFilter->SetOutputSpacing(outImage->GetSignedSpacing()); // nec qd capteur
m_OutputProjectionRef = outImage->GetProjectionRef(); // ~ wkt
if (m_OutputProjectionRef.empty())
{
......
......@@ -173,7 +173,7 @@ private:
m_Vproj->SetInput(m_Connected->GetFilter()->GetOutputVectorData());
m_Vproj->SetInputKeywordList(inputImage->GetImageKeywordlist());
//m_Vproj->SetInputOrigin(inputImage->GetOrigin());
//m_Vproj->SetInputSpacing(inputImage->GetSpacing());
//m_Vproj->SetInputSpacing(inputImage->GetSignedSpacing());
// Setup the DEM Handler
otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
......
......@@ -688,8 +688,8 @@ private:
epipolarGridSource->Update();
FloatImageType::SpacingType epiSpacing;
epiSpacing[0] = 0.5 * (vcl_abs(inleft->GetSpacing()[0]) + vcl_abs(inleft->GetSpacing()[1]));
epiSpacing[1] = 0.5 * (vcl_abs(inleft->GetSpacing()[0]) + vcl_abs(inleft->GetSpacing()[1]));
epiSpacing[0] = 0.5 * (vcl_abs(inleft->GetSignedSpacing()[0]) + vcl_abs(inleft->GetSignedSpacing()[1]));
epiSpacing[1] = 0.5 * (vcl_abs(inleft->GetSignedSpacing()[0]) + vcl_abs(inleft->GetSignedSpacing()[1]));
FloatImageType::SizeType epiSize;
epiSize = epipolarGridSource->GetRectifiedImageSize();
......@@ -721,7 +721,7 @@ private:
leftInverseDisplacementFieldFilter->SetInput(leftDisplacement);
FloatVectorImageType::PointType lorigin = inleft->GetOrigin();
FloatVectorImageType::SpacingType lspacing = inleft->GetSpacing();
FloatVectorImageType::SpacingType lspacing = inleft->GetSignedSpacing();
FloatVectorImageType::SizeType lsize = inleft->GetLargestPossibleRegion().GetSize();
double gridStep = epipolarGridSource->GetGridStep();
lspacing[0] *= gridStep;
......
......@@ -229,7 +229,7 @@ private:
{
FloatImageType::PointType origin = GetParameterImage("io.inleft")->GetOrigin();
FloatImageType::SizeType size = GetParameterImage("io.inleft")->GetLargestPossibleRegion().GetSize();
FloatImageType::SpacingType spacing = GetParameterImage("io.inleft")->GetSpacing();
FloatImageType::SpacingType spacing = GetParameterImage("io.inleft")->GetSignedSpacing();
size[0]/=GetParameterInt("epi.elevation.avgdem.step");
size[1]/=GetParameterInt("epi.elevation.avgdem.step");
......@@ -289,7 +289,7 @@ private:
m_LeftInvertDisplacementFieldFilter->SetInput(m_LeftDisplacementFieldCaster->GetOutput());
FloatVectorImageType::PointType lorigin = GetParameterImage("io.inleft")->GetOrigin();
FloatVectorImageType::SpacingType lspacing = GetParameterImage("io.inleft")->GetSpacing();
FloatVectorImageType::SpacingType lspacing = GetParameterImage("io.inleft")->GetSignedSpacing();
FloatVectorImageType::SizeType lsize = GetParameterImage("io.inleft")->GetLargestPossibleRegion().GetSize();
if (lsize[0]*lsize[1]>256*256)
......@@ -331,7 +331,7 @@ private:
m_RightInvertDisplacementFieldFilter->SetInput(m_RightDisplacementFieldCaster->GetOutput());
FloatVectorImageType::PointType rorigin = GetParameterImage("io.inright")->GetOrigin();
FloatVectorImageType::SpacingType rspacing = GetParameterImage("io.inright")->GetSpacing();
FloatVectorImageType::SpacingType rspacing = GetParameterImage("io.inright")->GetSignedSpacing();
FloatVectorImageType::SizeType rsize = GetParameterImage("io.inright")->GetLargestPossibleRegion().GetSize();
if (rsize[0]*rsize[1]>256*256)
......
......@@ -233,7 +233,7 @@ private:
origin = referenceImage->GetOrigin();
spacing = referenceImage->GetSpacing();
spacing = referenceImage->GetSignedSpacing();
}
else if (HasValue("spx") && HasValue("spy"))
{
......
......@@ -140,8 +140,8 @@ private:
parameters[1] = CONST_PI * GetParameterFloat("transform.ro")/180.;
parameters[2] = GetParameterFloat("transform.centerx");
parameters[3] = GetParameterFloat("transform.centery");
parameters[4] = inImage->GetSpacing()[0] * GetParameterFloat("transform.tx");
parameters[5] = vcl_abs(inImage->GetSpacing()[1]) * GetParameterFloat("transform.ty");
parameters[4] = inImage->GetSignedSpacing()[0] * GetParameterFloat("transform.tx");
parameters[5] = vcl_abs(inImage->GetSignedSpacing()[1]) * GetParameterFloat("transform.ty");
// Set the parameters to the transform
m_Transform->SetParameters(parameters);
......
......@@ -113,7 +113,7 @@ public:
}
/** Set the spacing (size of a pixel) of the image.
* \sa GetSpacing() */
* \sa GetSignedSpacing() */
itkSetVectorMacro(Spacing, const double, OutputImageType::ImageDimension);
itkSetVectorMacro(Spacing, const float, OutputImageType::ImageDimension);
......
......@@ -169,7 +169,7 @@ ImportImageFilter<TOutputImage>
// we need to compute the output spacing, the output origin, the
// output image size, and the output image start index
outputPtr->SetSpacing(m_Spacing);
outputPtr->SetSignedSpacing(m_Spacing);
outputPtr->SetOrigin(m_Origin);
outputPtr->SetDirection(m_Direction);
outputPtr->SetLargestPossibleRegion(m_Region);
......
......@@ -114,7 +114,7 @@ public:
}
/** Set the spacing (size of a pixel) of the image.
* \sa GetSpacing() */
* \sa GetSignedSpacing() */
itkSetVectorMacro(Spacing, const double, OutputImageType::ImageDimension);
itkSetVectorMacro(Spacing, const float, OutputImageType::ImageDimension);
......
......@@ -170,7 +170,7 @@ ImportVectorImageFilter<TOutputImage>
// we need to compute the output spacing, the output origin, the
// output image size, and the output image start index
outputPtr->SetSpacing(m_Spacing);
outputPtr->SetSignedSpacing(m_Spacing);
outputPtr->SetOrigin(m_Origin);
outputPtr->SetDirection(m_Direction);
outputPtr->SetLargestPossibleRegion(m_Region);
......
......@@ -247,7 +247,7 @@ ExtractROIBase<TInputImage, TOutputImage>
// This logic needs to be augmented with logic that select which
// dimensions to copy
const typename InputImageType::SpacingType&
inputSpacing = inputPtr->GetSpacing();
inputSpacing = inputPtr->GetSignedSpacing();
const typename InputImageType::DirectionType&
inputDirection = inputPtr->GetDirection();
const typename InputImageType::PointType&
......@@ -304,7 +304,7 @@ ExtractROIBase<TInputImage, TOutputImage>
}
// set the spacing and origin
outputPtr->SetSpacing(outputSpacing);
outputPtr->SetSignedSpacing(outputSpacing);
outputPtr->SetDirection(outputDirection);
outputPtr->SetOrigin(outputOrigin);
......
......@@ -177,6 +177,14 @@ public:
/** Get signed spacing */
SpacingType GetSignedSpacing() const;
// SpacingType GetSpacing() const
// {
// PixelType a;
// a.toto();
// SpacingType t = this->GetSignedSpacing();
// return t ;
// };
/** Set signed spacing */
virtual void SetSignedSpacing( SpacingType spacing );
virtual void SetSignedSpacing( double spacing[ VImageDimension ] );
......
......@@ -61,7 +61,7 @@ int otbImageTest(int itkNotUsed(argc), char* argv[])
std::cout << "---------------------" << std::endl;
file << "------ IMAGE --------" << std::endl;
file << "Spacing " << image->GetSpacing() << std::endl;
file << "Spacing " << image->GetSignedSpacing() << std::endl;
file << "Origin " << image->GetOrigin() << std::endl;
file << "Projection REF " << image->GetProjectionRef() << std::endl;
file << "GCP Projection " << image->GetGCPProjection() << std::endl;
......
......@@ -63,7 +63,7 @@ int otbVectorImageLegacyTest(int argc, char* argv[])
std::cout << "---------------------" << std::endl;
file << "------ IMAGE --------" << std::endl;
file << "Spacing " << image->GetSpacing() << std::endl;
file << "Spacing " << image->GetSignedSpacing() << std::endl;
file << "Origin " << image->GetOrigin() << std::endl;
file << "Projection REF " << image->GetProjectionRef() << std::endl;
file << "GCP Projection " << image->GetGCPProjection() << std::endl;
......
......@@ -245,7 +245,7 @@ BSplineInterpolateImageFunction<TImageType, TCoordRep, TCoefficientType>
}
derivativeValue[n] += m_Coefficients->GetPixel(coefficientIndex) * tempValue;
}
derivativeValue[n] /= this->GetInputImage()->GetSpacing()[n]; // take spacing into account
derivativeValue[n] /= this->GetInputImage()->GetSignedSpacing()[n]; // take spacing into account
}
return (derivativeValue);
......
......@@ -54,7 +54,7 @@ int otbProlateValidationTest(int itkNotUsed(argc), char * argv[])
reader->UpdateOutputInformation();
ImageType::PointType origin = reader->GetOutput()->GetOrigin();
ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing();
ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing();
ImageType::SpacingType newSpacing;
newSpacing[0] = spacing[0] * factor;
newSpacing[1] = spacing[1] * factor;
......
......@@ -205,13 +205,13 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
double sizePerPixel = 1;
for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
{
sizePerPixel *= vcl_abs(m_LabelImage->GetSpacing()[i]);
sizePerPixel *= vcl_abs(m_LabelImage->GetSignedSpacing()[i]);
}
typename std::vector<double> sizePerPixelPerDimension;
for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
{
sizePerPixelPerDimension.push_back(sizePerPixel / vcl_abs(m_LabelImage->GetSpacing()[i]));
sizePerPixelPerDimension.push_back(sizePerPixel / vcl_abs(m_LabelImage->GetSignedSpacing()[i]));