GetIndexFromMouseClick()
{
LeftEyeIndex[0] = 60;
LeftEyeIndex[1] = 127;
LeftEyeIndex[2] = 93;
return LeftEyeIndex;
}
int
main(int, char *[])
{
{ 200, 200, 200 }
};
{ 0, 0, 0 }
};
region.SetIndex(start);
image->SetRegions(region);
image->Allocate(true);
ImageType::SpacingType spacing;
spacing[0] = 0.33;
spacing[1] = 0.33;
spacing[2] = 1.20;
image->SetSpacing(spacing);
const ImageType::SpacingType & sp = image->GetSpacing();
std::cout << "Spacing = ";
std::cout << sp[0] << ", " << sp[1] << ", " << sp[2] << std::endl;
image->SetOrigin(newOrigin);
std::cout << "Origin = ";
std::cout << origin[0] << ", " << origin[1] << ", " << origin[2]
<< std::endl;
image->SetDirection(direction);
std::cout << "Direction = " << std::endl;
std::cout << direct << std::endl;
const bool isInside =
image->TransformPhysicalPointToIndex(
point, pixelIndex);
if (isInside)
{
ImageType::PixelType pixelValue = image->GetPixel(pixelIndex);
pixelValue += 5;
image->SetPixel(pixelIndex, pixelValue);
}
image->TransformIndexToPhysicalPoint(LeftEyeIndex, LeftEyePoint);
std::cout << "===========================================" << std::endl;
std::cout << "The Left Eye Location is " << LeftEyePoint << std::endl;
using MatrixType =
MatrixType SpacingMatrix;
SpacingMatrix.
Fill(0.0F);
const ImageType::SpacingType & ImageSpacing = image->GetSpacing();
SpacingMatrix(0, 0) = ImageSpacing[0];
SpacingMatrix(1, 1) = ImageSpacing[1];
SpacingMatrix(2, 2) = ImageSpacing[2];
image->GetDirection();
LeftEyeIndexVector[0] = LeftEyeIndex[0];
LeftEyeIndexVector[1] = LeftEyeIndex[1];
LeftEyeIndexVector[2] = LeftEyeIndex[2];
ImageOrigin + ImageDirectionCosines * SpacingMatrix * LeftEyeIndexVector;
std::cout << "===========================================" << std::endl;
std::cout << "Spacing:: " << std::endl << SpacingMatrix << std::endl;
std::cout << "===========================================" << std::endl;
std::cout << "DirectionCosines:: " << std::endl
<< ImageDirectionCosines << std::endl;
std::cout << "===========================================" << std::endl;
std::cout << "Origin:: " << std::endl << ImageOrigin << std::endl;
std::cout << "===========================================" << std::endl;
std::cout << "The Left Eye Location is " << LeftEyePointByHand << std::endl;
if ((LeftEyePointByHand - LeftEyePoint).
GetNorm() < 0.01F)
{
std::cout << "===========================================" << std::endl;
std::cout << "Two results are identical as expected!" << std::endl;
std::cout << "The Left Eye from TransformIndexToPhysicalPoint is "
<< LeftEyePoint << std::endl;
std::cout << "The Left Eye from Math is " << LeftEyePointByHand
<< std::endl;
}
return EXIT_SUCCESS;
}