MRFImageFilter classification image

Hello,

I’m following up to a question I posted awhile back, but never received a response about. I hope I can simplify my question in order to get some feedback. I’m playing around with the MRFImageFilter and am confused about the image inputs for the function.
In the examples within Examples/Statistics/ScalarImageMarkovRandomField1.cxx and Examples/Segmentation/GibbsPriorImageFilter1.cxx, both scripts take a two input images. The first is the original image and the second is an initial classification for that image.
In both of these examples, the labelReader used for the classification image is not used again after the image is read. This leads me to believe that the classification image is not actually an input into the MRF-based filter.

I would appreciate any discussion or feedback!
Thank you,
Courtney

You are right about MRF example, the reading but not using issue goes back at least to 2004:

What happens if you modify the example so the filter also uses labelReader->GetOutput()?

But Gibbs example uses the other image:

Hello Dženan,

Thanks so much for your response and I apologize for getting back to you so late.

I tried adding the labeled image into the MRF input.

scalarToArrayFilter->SetInput1(reader->GetOutput());
scalarToArrayFilter->SetInput2(labelReader->GetOutput());
using MRFFilterType = itk::MRFImageFilter< ArrayImageType, LabelImageType >;
MRFFilterType::Pointer mrfFilter = MRFFilterType::New();
mrfFilter->SetInput(scalarToArrayFilter->GetOutput());

I’m able to build and run successfully, but it doesn’t look like the image is taking the segmentation (labeled) image into account at all. When I send any image (that is the same size) in as the initial labeled image, I’m getting the exact same labeled image as a result of the MRF filter. It’s also the same resultant image as running the example without the labeled image as an input. I’m using all of the same parameters provided in the example, so maybe I have to play with those a bit more. I’d appreciate any insight you may have.

Thank you,
Courtney

I doubt I looked at this filter before you brought it up, so you are as familiar with it as I am, if not more.

In filters with a lot of tuning parameters, it is frequent that they need to be set right to produce a non-trivial (e.g. different from input) result.