added new fields to COnfig View and Number Of hIstogram bins in MI
This commit is contained in:
@ -95,6 +95,7 @@ public:
|
||||
* typically results in narrower valleys in the cost fucntion.
|
||||
* Default value is false. */
|
||||
itkSetMacro(SubtractMean, bool);
|
||||
itkSetMacro(NumberOfHistogramBins, int);
|
||||
itkGetConstReferenceMacro(SubtractMean, bool);
|
||||
itkBooleanMacro(SubtractMean);
|
||||
|
||||
@ -106,6 +107,7 @@ protected:
|
||||
|
||||
private:
|
||||
bool m_SubtractMean;
|
||||
int m_NumberOfHistogramBins;
|
||||
};
|
||||
|
||||
} // end namespace itk
|
||||
|
@ -36,6 +36,7 @@ MutualInformationTwoImageToOneImageMetric<TFixedImage,
|
||||
TMovingImage>::MutualInformationTwoImageToOneImageMetric()
|
||||
{
|
||||
m_SubtractMean = false;
|
||||
m_NumberOfHistogramBins = 50;
|
||||
}
|
||||
|
||||
template <typename TFixedImage, typename TMovingImage>
|
||||
@ -147,7 +148,8 @@ MutualInformationTwoImageToOneImageMetric<TFixedImage, TMovingImage>::GetValue()
|
||||
//auto numberOfSamples = static_cast<unsigned int>(numberOfPixels * 0.50); //100%
|
||||
// since we have a ROI, then we should not set allPixels to TRUE.
|
||||
//metric1->UseAllPixelsOn();
|
||||
metric1->SetNumberOfHistogramBins(50);
|
||||
std::cout << "m_NumberOfHistogramBins " << m_NumberOfHistogramBins << std::endl;
|
||||
metric1->SetNumberOfHistogramBins(m_NumberOfHistogramBins);
|
||||
|
||||
// InternalImageType::IndexType pIndex;
|
||||
// pIndex[0]=200;
|
||||
@ -183,7 +185,7 @@ MutualInformationTwoImageToOneImageMetric<TFixedImage, TMovingImage>::GetValue()
|
||||
//numberOfSamples = static_cast<unsigned int>(numberOfPixels * 0.50); //100%
|
||||
//metric2->SetNumberOfSpatialSamples(numberOfSamples);
|
||||
//metric2->UseAllPixelsOn();
|
||||
metric2->SetNumberOfHistogramBins(50);
|
||||
metric2->SetNumberOfHistogramBins(m_NumberOfHistogramBins);
|
||||
metric2->SetFixedImage(fixedImage2);
|
||||
metric2->SetMovingImage(this->m_Filter2->GetOutput());
|
||||
metric2->Initialize();
|
||||
|
@ -1236,8 +1236,9 @@ void itkImageProcessor::SetAmoebaOptimParameters(
|
||||
|
||||
}
|
||||
|
||||
void itkImageProcessor::SetMIMetricParameters(double dMaxT){
|
||||
void itkImageProcessor::SetMIMetricParameters(double dMaxT,int iNhb){
|
||||
m_MIMetricMetaInfo->SetMaxTranslation(dMaxT);
|
||||
m_MIMetricMetaInfo->SetNumberOfHistogramBins(iNhb);
|
||||
}
|
||||
|
||||
void itkImageProcessor::SetNCCMetricParameters(double dMaxT,bool bSm){
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
void SetAmoebaOptimParameters(double,double,double,int);
|
||||
|
||||
/** Set MI */
|
||||
void SetMIMetricParameters(double);
|
||||
void SetMIMetricParameters(double,int);
|
||||
|
||||
/** Set NCC */
|
||||
void SetNCCMetricParameters(double,bool);
|
||||
|
@ -13,6 +13,7 @@ itkReg23::itkReg23()
|
||||
NCCmetric = MetricType::New();
|
||||
MImetric = MIMetricType::New();
|
||||
|
||||
|
||||
// Optimizers
|
||||
PowellOptimizer = PowellOptimizerType::New();
|
||||
AmoebaOptimizer = AmoebaOptimizerType::New();
|
||||
@ -205,6 +206,7 @@ void itkReg23::InitializeRegistration()
|
||||
std::cout<< "Using MI Metric" <<std::endl;
|
||||
|
||||
registration->SetMetric(MImetric);
|
||||
MImetric->SetNumberOfHistogramBins(m_MIMeta->GetNumberOfHistogramBins());
|
||||
MImetric->ComputeGradientOff();
|
||||
MImetric->SetMaxTranslation(m_MIMeta->GetMaxTranslation());
|
||||
|
||||
|
@ -59,6 +59,7 @@ MIMetricMetaInformation::
|
||||
MIMetricMetaInformation(){
|
||||
|
||||
this->m_MaxTranslation = 100.0;
|
||||
this->m_NumberOfHistogramBins = 50;
|
||||
|
||||
}
|
||||
|
||||
|
@ -150,11 +150,15 @@ public:
|
||||
itkSetMacro(MaxTranslation,double);
|
||||
itkGetMacro(MaxTranslation,double);
|
||||
|
||||
itkSetMacro(NumberOfHistogramBins,int);
|
||||
itkGetMacro(NumberOfHistogramBins,int);
|
||||
|
||||
protected:
|
||||
|
||||
double m_MaxTranslation;
|
||||
|
||||
int m_NumberOfHistogramBins;
|
||||
|
||||
|
||||
/** Default Constructor **/
|
||||
MIMetricMetaInformation ();
|
||||
|
Reference in New Issue
Block a user