Skip to content

Commit

Permalink
contact area desc refined
Browse files Browse the repository at this point in the history
  • Loading branch information
owodo committed Mar 22, 2021
1 parent 872a018 commit 74e5672
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/graspi_descriptors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace graspi {

bool IsZero(float i){if (std::fabs(i)<1e-10 ) return true; else return false;}

/// structure storing the list of descriptors
struct DESC{
std::vector<desc_t> desc; ///< the vector of descriptors
Expand Down Expand Up @@ -79,10 +81,10 @@ namespace graspi {
// desc.push_back(p_desc);
// p_desc.first = -1; p_desc.second = "CT_wtort_A";// weighted_fraction_of_white_vertices_with_preferably_straight_rising_paths
// desc.push_back(p_desc);
// p_desc.first = -1; p_desc.second = "CT_n_A_adj_Ca";// number_of_white_vertices_in_direct_contact_with_blue
// desc.push_back(p_desc);
// p_desc.first = -1; p_desc.second = "CT_n_D_adj_An";// number_of_black_vertices_in_direct_contact_with_red
// desc.push_back(p_desc);
p_desc.first = -1; p_desc.second = "CT_n_D_adj_An";// number_of_black_vertices_in_direct_contact_with_red
desc.push_back(p_desc);
p_desc.first = -1; p_desc.second = "CT_n_A_adj_Ca";// number_of_white_vertices_in_direct_contact_with_blue
desc.push_back(p_desc);

}

Expand Down
15 changes: 15 additions & 0 deletions src/performance_indicators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ namespace graspi {
compute_shortest_distance_from_sourceC_to_targetC(RED,BLACK,
G, d_g, C, W,
distances);
int distZero=count_if(distances.begin(), distances.end(), IsZero);
descriptors.update_desc("CT_n_D_adj_An",distZero);

double black_tort_1
= determine_tortuosity( C, d_a, pixelsize,distances,RED,BLACK);

Expand All @@ -164,6 +167,10 @@ namespace graspi {
compute_shortest_distance_from_sourceC_to_targetC(BLUE,WHITE,
G, d_g, C, W,
distances);
distZero=count_if(distances.begin(), distances.end(), IsZero);
descriptors.update_desc("CT_n_A_adj_Ca",distZero);


double white_tort_1
= determine_tortuosity( C, d_a, pixelsize,distances, BLUE,WHITE);
descriptors.update_desc("CT_f_A_tort1",white_tort_1);
Expand Down Expand Up @@ -266,6 +273,10 @@ namespace graspi {
compute_shortest_distance_from_sourceC_to_targetC(RED,BLACK,
G, d_g, C, W,
distances, filename);

int distZero=count_if(distances.begin(), distances.end(), IsZero);
descriptors.update_desc("CT_n_D_adj_An",distZero);

filename = res_path + std::string("DistancesGreenToRedViaBlack.txt");
print_distances_of_ids(distances,id_blacks_conn_green_red,
filename);
Expand All @@ -285,6 +296,10 @@ namespace graspi {
compute_shortest_distance_from_sourceC_to_targetC(BLUE,WHITE,
G, d_g, C, W,
distances, filename);

distZero=count_if(distances.begin(), distances.end(), IsZero);
descriptors.update_desc("CT_n_A_adj_Ca",distZero);

filename = res_path + std::string("DistancesGreenToBlueViaWhite.txt");
print_distances_of_ids(distances,id_whites_conn_green_blue,
filename);
Expand Down

0 comments on commit 74e5672

Please sign in to comment.