@matt.mccormick Hi and thank you for your reply.
Once I un-commented the
classifier->SetClassifiedImage(prediction); //+
classifier->Update(); //+
It is showing the following error:
terminate called after throwing an instance of 'itk::ExceptionObject'
what(): /usr/local/include/ITK-5.0/itkClassifierBase.hxx:67:
itk::ERROR: ImageClassifierBase(0x17adc50): Zero class
Then I added the classifier->SetNumberOfClasses(numberOfClasses);
and the output is still blank image. Once I add the classifier->Update();
for updating the classifier, it still shows an error in the output:
WARNING: In /usr/local/include/ITK-5.0/itkImageSink.hxx, line 88
LabelStatisticsImageFilter (0x20fed30): Unable to convert input "LabelInput" to type N3itk5ImageIfLj3EEE
Number of labels: 5
Label: 4
mean: 0.43653
Label: 0
mean: 0.278904
Label: 1
mean: 0.115523
Label: 2
mean: 0.496039
Label: 3
mean: 0.121493
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
I printed out the MRF and the output is:
MRFImageFilter (0xfe4020)
RTTI typeinfo: itk::MRFImageFilter<itk::Image<itk::FixedArray<unsigned char, 1u>, 3u>, itk::Image<unsigned char, 3u> >
Reference Count: 1
Modified Time: 544
Debug: Off
Object Name:
Observers:
none
Inputs:
Primary: (0xfeaf80) *
Indexed Inputs:
0: Primary (0xfeaf80)
Required Input Names: Primary
NumberOfRequiredInputs: 1
Outputs:
Primary: (0xfea1e0)
Indexed Outputs:
0: Primary (0xfea1e0)
NumberOfRequiredOutputs: 1
Number Of Work Units: 32
ReleaseDataFlag: Off
ReleaseDataBeforeUpdateFlag: Off
AbortGenerateData: Off
Progress: 0
Multithreader:
RTTI typeinfo: itk::PoolMultiThreader
Reference Count: 1
Modified Time: 528
Debug: Off
Object Name:
Observers:
none
Number of Work Units: 32
Number of Threads: 8
Global Maximum Number Of Threads: 128
Global Default Number Of Threads: 8
Global Default Threader Type: PoolMultiThreader
SingleMethod: 0
SingleData: 0
DynamicMultiThreading: On
CoordinateTolerance: 1e-06
DirectionTolerance: 1e-06
MRF Image filter object
Number of classes: 5
Maximum number of iterations: 100
Error tolerance for convergence: 1e-07
Size of the MRF neighborhood radius:[1, 1, 1]
Number of elements in MRF neighborhood :27
Neighborhood weight : (0.00385276, 0.00385276, 0.00385276, 0.00385276, 0.00444549, 0.00385276, 0.00385276, 0.00385276, 0.00385276, 0.00503822, 0.00503822, 0.00503822, 0.00503822, 0.00503822, 0.00503822, 0.00503822, 0.00503822, 0.00503822, 0.00385276, 0.00385276, 0.00385276, 0.00385276, 0.00444549, 0.00385276, 0.00385276, 0.00385276, 0.00385276)
Smoothing factor for the MRF neighborhood:0.8
Then, I checked the minimum and maximum value of intensity rescaled mrfFilter
output image.
ImageMinMaxCalculatorFilterType::Pointer imageMinMaxCalculator=ImageMinMaxCalculatorFilterType::New();
imageMinMaxCalculator->SetImage(intensityRescaler->GetOutput());
imageMinMaxCalculator->Compute();
std::cout<<"Min value of image: "<<(int)imageMinMaxCalculator->GetMinimum()<<" and Max: "<<(int)imageMinMaxCalculator->GetMaximum()<<std::endl;
Min value of image: 255 and Max: 0
, in which the setting for intensityRescaler
is the opposite. I am wondering what is happening here.
shows:
StopCondition: 1
Number of iterations: 0
Min value of image: 255 and Max: 0
Number of Iterations : 1
Stop condition:
(1) Maximum number of iterations
(2) Error tolerance:
2