49 vtkInformationVector **inputVector,
50 vtkInformationVector *outputVector) {
53 vtkTable *input1 = vtkTable::GetData(inputVector[0]);
54 vtkTable *input2 = vtkTable::GetData(inputVector[1]);
55 vtkTable *output = vtkTable::GetData(outputVector);
56 if(!input1 || !input2 || !output)
60 vtkDataArray *inputClustering1 = this->GetInputArrayToProcess(0, input1);
61 vtkDataArray *inputClustering2 = this->GetInputArrayToProcess(1, input2);
63 if(!inputClustering1) {
64 this->
printErr(
"Unable to retrieve input array for first clustering.");
67 if(!inputClustering2) {
68 this->
printErr(
"Unable to retrieve input array for second clustering.");
72 vtkIntArray *intArray1 = vtkIntArray::SafeDownCast(inputClustering1);
73 vtkIntArray *intArray2 = vtkIntArray::SafeDownCast(inputClustering2);
76 const int *values1 = ttkUtils::GetPointer<int>(inputClustering1);
77 const int *values2 = ttkUtils::GetPointer<int>(inputClustering2);
80 this->
printMsg(
"Starting computation...");
81 this->
printMsg(
" First clustering column: "
82 + std::string(intArray1->GetName()));
83 this->
printMsg(
" Second clustering column: "
84 + std::string(intArray2->GetName()));
86 size_t const nbVal1 = inputClustering1->GetNumberOfTuples();
87 size_t const nbVal2 = inputClustering2->GetNumberOfTuples();
89 if(nbVal1 != nbVal2) {
90 this->
printMsg(
"Error : the two clusterings must have the same size\n");
93 size_t const nbVal = nbVal1;
95 double nmiValue = 0, ariValue = 0;
96 this->
execute(values1, values2, nbVal, nmiValue, ariValue);
97 vtkNew<vtkDoubleArray> nmiValArray{}, ariValArray{};
98 output->SetNumberOfRows(1);
100 nmiValArray->SetName(
"NMIValue");
101 nmiValArray->SetNumberOfTuples(1);
102 nmiValArray->SetTuple1(0, nmiValue);
103 output->AddColumn(nmiValArray);
105 ariValArray->SetName(
"ARIValue");
106 ariValArray->SetNumberOfTuples(1);
107 ariValArray->SetTuple1(0, ariValue);
108 output->AddColumn(ariValArray);
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)