src/GRAPHGEN/conact_code_generator.cpp
// This is the function to generate Connected Component Labeling action code
This is the function to generate Connected Component Labeling action code
This is the function to generate Connected Component Labeling action code
void GenerateActionsCode(ofstream& os, const rule_set& rs, const pixel_set& names, bool with_continues = true)
{
    auto& shifts = rs.ps_.shifts_; 
    size_t n_dims = shifts.size(); 
    os << "\n\n//Actions:\n";
    for (size_t a = 0; a < rs.actions.size(); ++a) {
        string cur_action = rs.actions[a];
        os << "// Action " << a + 1 << ": " << cur_action << "\n";
        os << "#define ACTION_" << a + 1 << " ";
        string where_to_write = "img_labels_" + string(n_dims > 2 ? "slice00_" : "") + "row00[c] = ";
        os << where_to_write << CreateAssignmentCode(cur_action, names) << ";";
        if (with_continues) {
            os << "continue;";
        }
        os << "\n";
    }
}
void GenerateActionsCode ( ofstream & os , const rule_set & rs , const pixel_set & names , bool with_continues = true ) { auto & shifts = rs . ps_ . shifts_ ; size_t n_dims = shifts . size ( ) ; os << " \n \n \n " ; for ( size_t a = 0 ; a < rs . actions . size ( ) ; ++ a ) { string cur_action = rs . actions [ a ] ; os << " " << a + 1 << " " << cur_action << " \n " ; os << " " << a + 1 << " " ; string where_to_write = " " + string ( n_dims > 2 ? " " : " " ) + " " ; os << where_to_write << CreateAssignmentCode ( cur_action , names ) << " " ; if ( with_continues ) { os << " " ; } os << " \n " ; } }
This is the function to generate Connected Component Labeling action code
This is the function to generate Connected Component Labeling action code
// Shifts on each dim -> [x, y] or [x, y, z] // Here we get how many dims image has // Actions: