ROI implemented - check functionalities on proper dataset
This commit is contained in:
@ -156,12 +156,14 @@ void TwoProjectionImageRegistrationMethod<TFixedImage, TMovingImage>::Initialize
|
||||
|
||||
if (m_FixedImageRegionDefined1) {
|
||||
m_Metric->SetFixedImageRegion1(m_FixedImageRegion1);
|
||||
std::cout << "m_FixedImageRegionDefined1 is defined " << std::endl;
|
||||
} else {
|
||||
m_Metric->SetFixedImageRegion1(m_FixedImage1->GetBufferedRegion());
|
||||
}
|
||||
|
||||
if (m_FixedImageRegionDefined2) {
|
||||
m_Metric->SetFixedImageRegion2(m_FixedImageRegion2);
|
||||
std::cout << "m_FixedImageRegionDefined2 is defined " << std::endl;
|
||||
} else {
|
||||
m_Metric->SetFixedImageRegion2(m_FixedImage2->GetBufferedRegion());
|
||||
}
|
||||
|
@ -1414,7 +1414,10 @@ itkImageProcessor::CalculateInternalTransform(
|
||||
m_OutputTransform;
|
||||
}
|
||||
|
||||
void itkImageProcessor::InitializeRegistration(double stepLength, double maxTranslation, eDegreeOfFreedomType dof)
|
||||
void itkImageProcessor::InitializeRegistration(
|
||||
double stepLength,
|
||||
double maxTranslation,
|
||||
eDegreeOfFreedomType dof)
|
||||
{
|
||||
std::cout << "*" << __COMPACT_PRETTY_FUNCTION__ << std::endl;
|
||||
|
||||
@ -1449,28 +1452,33 @@ void itkImageProcessor::InitializeRegistration(double stepLength, double maxTran
|
||||
|
||||
//TODO: Here we could set the ROI for image registartion
|
||||
|
||||
|
||||
if (m_UseFullROI == false) {
|
||||
|
||||
auto region1 = m_PASourceDupli->GetOutput()->GetBufferedRegion();
|
||||
auto region2 = m_LATSourceDupli->GetOutput()->GetBufferedRegion();
|
||||
std::cout << "region1 of opti - NO ROI " << region1 << std::endl;
|
||||
std::cout << "region2 of opti - NO ROI " << region2 << std::endl;
|
||||
|
||||
// bool setROI = false;
|
||||
// if (setROI) {
|
||||
// auto index1 = region1.GetIndex();
|
||||
// auto size1 = region1.GetSize();
|
||||
// auto point1 = m_PASourceDupli->GetOutput()->GetOrigin();
|
||||
registration->SetFixedImageRegion1(roiAutoReg1);
|
||||
registration->SetFixedImageRegion2(roiAutoReg2);
|
||||
|
||||
// index1[0] = size1[0] / 2 - 50;
|
||||
// index1[1] = size1[1] / 2 - 50;
|
||||
std::cout << "using ROIs for Auto Reg " << std::endl;
|
||||
|
||||
// size1[0] = 100;
|
||||
// size1[1] = 100;
|
||||
// size1[2] = 1;
|
||||
std::cout << "region1 of opti " << roiAutoReg1 << std::endl;
|
||||
std::cout << "region2 of opti " << roiAutoReg2 << std::endl;
|
||||
|
||||
// region1.SetIndex(index1);
|
||||
// region1.SetSize(size1);
|
||||
// }
|
||||
}else{
|
||||
|
||||
auto region1 = m_PASourceDupli->GetOutput()->GetBufferedRegion();
|
||||
auto region2 = m_LATSourceDupli->GetOutput()->GetBufferedRegion();
|
||||
std::cout << "region1 of opti - NO ROI " << region1 << std::endl;
|
||||
std::cout << "region2 of opti - NO ROI " << region2 << std::endl;
|
||||
|
||||
registration->SetFixedImageRegion1(region1);
|
||||
registration->SetFixedImageRegion2(region2);
|
||||
}
|
||||
|
||||
|
||||
registration->SetTransformMetaInfo(m_TransformMetaInfo);
|
||||
|
||||
@ -2446,7 +2454,8 @@ void itkImageProcessor::GetProjectionImages(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::cout<<"Curr GetCenter"<<CurrTransform->GetCenter()<<std::endl;
|
||||
if(m_RTMetaInfo != NULL) std::cout<<"IsoCenter"<<m_RTMetaInfo->GetIsocenterLPS()<<std::endl;
|
||||
|
||||
transform1->SetComputeZYX(true);
|
||||
transform1->SetIdentity();
|
||||
@ -3190,5 +3199,50 @@ void itkImageProcessor::SetMaxNumberOfIterations(int iNum)
|
||||
// TODO: Remove this function when ROI functinalitz has been implemented.
|
||||
}
|
||||
|
||||
void itkImageProcessor::SetRegionFixed1(
|
||||
int iIdx0, int iIdx1, int iSz0, int iSz1){
|
||||
|
||||
auto region1temp = m_PASourceDupli->GetOutput()->GetBufferedRegion();
|
||||
|
||||
auto index1 = region1temp.GetIndex();
|
||||
auto size1 = region1temp.GetSize();
|
||||
|
||||
index1[0] = iIdx0;
|
||||
index1[1] = iIdx1;
|
||||
|
||||
size1[0] = iSz0;
|
||||
size1[1] = iSz1;
|
||||
size1[2] = 1;
|
||||
|
||||
roiAutoReg1.SetIndex(index1);
|
||||
roiAutoReg1.SetSize(size1);
|
||||
|
||||
std::cout << "itkImageProcessor " << std::endl;
|
||||
std::cout << roiAutoReg1 << std::endl;
|
||||
}
|
||||
|
||||
void itkImageProcessor::SetRegionFixed2(
|
||||
int iIdx0, int iIdx1, int iSz0, int iSz1){
|
||||
|
||||
auto region2temp = m_LATSourceDupli->GetOutput()->GetBufferedRegion();
|
||||
|
||||
auto index2 = region2temp.GetIndex();
|
||||
auto size2 = region2temp.GetSize();
|
||||
|
||||
index2[0] = iIdx0;
|
||||
index2[1] = iIdx1;
|
||||
|
||||
size2[0] = iSz0;
|
||||
size2[1] = iSz1;
|
||||
size2[2] = 1;
|
||||
|
||||
roiAutoReg2.SetIndex(index2);
|
||||
roiAutoReg2.SetSize(size2);
|
||||
|
||||
std::cout << "itkImageProcessor " << std::endl;
|
||||
std::cout << roiAutoReg2 << std::endl;
|
||||
|
||||
}
|
||||
|
||||
} // end namespace itk
|
||||
|
||||
|
@ -189,6 +189,8 @@ public:
|
||||
void SetMetric(std::string);
|
||||
void SetFullROI(bool);
|
||||
void SetMaxNumberOfIterations(int);
|
||||
void SetRegionFixed1(int,int,int,int);
|
||||
void SetRegionFixed2(int,int,int,int);
|
||||
|
||||
/** Optimizer which tries to find the minimn (Powell Optimizer)*/
|
||||
using OptimizerType = itk::PowellOptimizer;
|
||||
@ -238,6 +240,8 @@ private:
|
||||
/** The thing which actuall does the image registration*/
|
||||
using RegistrationType = itk::TwoProjectionImageRegistrationMethod<InternalImageType, InternalImageType>;
|
||||
|
||||
using RoiForRegistration = itk::ImageRegion<Dimension>;
|
||||
|
||||
/** Image reader types */
|
||||
using ImageReaderType2D = itk::ImageFileReader<ImageType2D>;
|
||||
using ImageReaderType3D = itk::ImageFileReader<ImageType3D>;
|
||||
@ -404,6 +408,11 @@ private:
|
||||
double m_OptmizerValue;
|
||||
int m_MaxNumberOfIterations;
|
||||
|
||||
RoiForRegistration
|
||||
roiAutoReg1,
|
||||
roiAutoReg2;
|
||||
|
||||
|
||||
bool m_UseExhaustiveOptmizer;
|
||||
bool m_UseAmeobaOptimizer;
|
||||
bool m_UseFullROI;
|
||||
|
Reference in New Issue
Block a user