+ /*
+ if (GetVerboseFlag()) {
+ std::cout << "Resize images to the union of bounding boxes: "
+ << input1->GetLargestPossibleRegion().GetSize() << std::endl;
+ }
+ */
+
+ /*
+ int width = 6;
+ std::cout << std::setw(width) << in1 << " "
+ << std::setw(width) << in2 << " "
+ << std::setw(width) << inter << " "
+ << std::setw(width) << u << " "
+ << std::setw(width) << l1notIn2 << " "
+ << std::setw(width) << l2notIn1 << " "
+ << std::setw(width) << dice << " "; //std::endl;
+ */
+
+ // Compute overlap, dice
+ typedef itk::LabelOverlapMeasuresImageFilter<ImageType> FilterType;
+ typename FilterType::Pointer diceFilter = FilterType::New();
+ diceFilter->SetSourceImage(input1);
+ diceFilter->SetTargetImage(input2);
+ diceFilter->Update();
+
+ // Display information
+ if (!GetLongFlag()) {
+ if (GetVerboseFlag()) {
+ std::cout << "Dice : ";
+ }
+ std::cout << diceFilter->GetDiceCoefficient() << std::endl;
+ }
+ else { // long options
+ if (GetVerboseFlag()) {
+ std::cout << "Dice Jaccard Source Target Inter Union SrComp TarComp" << std::endl;
+ }
+ typename FilterType::MapType m = diceFilter->GetLabelSetMeasures();
+ int width = 6;
+ std::cout << std::setw(width) << diceFilter->GetDiceCoefficient() << " "
+ << std::setw(width) << diceFilter->GetJaccardCoefficient() << " "
+ << std::setw(width) << m[m_Label1].m_Source << " "
+ << std::setw(width) << m[m_Label2].m_Target << " "
+ << std::setw(width) << m[m_Label1].m_Intersection << " "
+ << std::setw(width) << m[m_Label1].m_Union << " "
+ << std::setw(width) << m[m_Label1].m_SourceComplement << " "
+ << std::setw(width) << m[m_Label2].m_TargetComplement << " "
+ << std::endl;
+ }