From 6097a2fe89bcbb24928ae1d10d0a19fe7f2b323e Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Tue, 24 Jun 2025 10:43:36 -0400 Subject: [PATCH 1/3] add (spring) attachment and cycle phase signals --- core/PhysiCell_signal_behavior.cpp | 58 ++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/core/PhysiCell_signal_behavior.cpp b/core/PhysiCell_signal_behavior.cpp index 8780e8d7c..1da1cb3e9 100644 --- a/core/PhysiCell_signal_behavior.cpp +++ b/core/PhysiCell_signal_behavior.cpp @@ -142,13 +142,18 @@ void setup_signal_behavior_dictionaries( void ) map_index++; } + // current cycle phase + signal_to_int["current cycle phase"] = map_index; + int_to_signal[map_index] = "current cycle phase"; + // synonym + signal_to_int["cycle phase"] = map_index; + // mechanical pressure - // int map_index = m; + map_index++; signal_to_int[ "pressure"] = map_index; int_to_signal[map_index] = "pressure"; // total volume - map_index++; signal_to_int[ "volume"] = map_index; int_to_signal[map_index] = "volume"; @@ -207,6 +212,16 @@ void setup_signal_behavior_dictionaries( void ) int_to_signal[map_index] = "contact with basement membrane"; // synonym signal_to_int["contact with BM"] = map_index; + + // number of attachments + map_index++; + signal_to_int["number of attachments"] = map_index; + int_to_signal[map_index] = "number of attachments"; + + // number of spring attachments + map_index++; + signal_to_int["number of spring attachments"] = map_index; + int_to_signal[map_index] = "number of spring attachments"; // damage state @@ -795,6 +810,10 @@ std::vector get_signals( Cell* pCell ) for( int i=0; i < m ; i++ ) { signals[start_substrate_grad_ind+i] = norm( pCell->nearest_gradient(i) ); } + // current cycle phase + static int cycle_phase_ind = find_signal_index( "current cycle phase" ); + signals[cycle_phase_ind] = pCell->phenotype.cycle.data.current_phase_index; + // mechanical pressure static int pressure_ind = find_signal_index( "pressure"); signals[pressure_ind] = pCell->state.simple_pressure; @@ -857,6 +876,14 @@ std::vector get_signals( Cell* pCell ) static int BM_contact_ind = find_signal_index( "contact with basement membrane"); signals[BM_contact_ind] = (int) pCell->state.contact_with_basement_membrane; + // number of attachments + static int num_attachments_ind = find_signal_index( "number of attachments"); + signals[num_attachments_ind] = pCell->state.attached_cells.size(); + + // number of spring attachments + static int num_spring_attachments_ind = find_signal_index( "number of spring attachments"); + signals[num_spring_attachments_ind] = pCell->state.spring_attached_cells.size + // damage static int damage_ind = find_signal_index( "damage"); signals[damage_ind] = pCell->phenotype.cell_integrity.damage; @@ -1044,6 +1071,15 @@ double get_single_signal( Cell* pCell, int index ) return out; } + // current cycle phase + static int cycle_phase_ind = find_signal_index( "current cycle phase" ); + if( index == cycle_phase_ind ) + { + out = pCell->phenotype.cycle.data.current_phase_index; + out /= signal_scales[index]; + return out; + } + // mechanical pressure static int pressure_ind = find_signal_index( "pressure" ); if( index == pressure_ind ) @@ -1153,6 +1189,24 @@ double get_single_signal( Cell* pCell, int index ) return out; } + // number of attachments + static int num_attachments_ind = find_signal_index( "number of attachments"); + if( index == num_attachments_ind ) + { + out = pCell->state.attached_cells.size(); + out /= signal_scales[index]; + return out; + } + + // number of spring attachments + static int num_spring_attachments_ind = find_signal_index( "number of spring attachments"); + if( index == num_spring_attachments_ind ) + { + out = pCell->state.spring_attachments.size(); + out /= signal_scales[index]; + return out; + } + // damage static int damage_ind = find_signal_index( "damage"); if( index == damage_ind ) From e52e73b3c714b7af774b390fcea84a200c4cdc6a Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Tue, 19 Aug 2025 13:42:01 -0400 Subject: [PATCH 2/3] add current cycle phase index to signals --- core/PhysiCell_signal_behavior.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/core/PhysiCell_signal_behavior.cpp b/core/PhysiCell_signal_behavior.cpp index 8780e8d7c..e283d5203 100644 --- a/core/PhysiCell_signal_behavior.cpp +++ b/core/PhysiCell_signal_behavior.cpp @@ -141,7 +141,16 @@ void setup_signal_behavior_dictionaries( void ) map_index++; } - + + // current cycle phase index + signal_to_int["current cycle phase"] = map_index; + int_to_signal[map_index] = "current cycle phase"; + // synonyms + signal_to_int["current cycle phase index"] = map_index; + signal_to_int["cycle phase"] = map_index; + signal_to_int["cycle phase index"] = map_index; + + // mechanical pressure // int map_index = m; signal_to_int[ "pressure"] = map_index; @@ -795,6 +804,10 @@ std::vector get_signals( Cell* pCell ) for( int i=0; i < m ; i++ ) { signals[start_substrate_grad_ind+i] = norm( pCell->nearest_gradient(i) ); } + // current cycle phase + static int cycle_phase_ind = find_signal_index( "current cycle phase index" ); + signals[cycle_phase_ind] = pCell->phenotype.cycle.current_phase_index(); + // mechanical pressure static int pressure_ind = find_signal_index( "pressure"); signals[pressure_ind] = pCell->state.simple_pressure; @@ -1044,6 +1057,15 @@ double get_single_signal( Cell* pCell, int index ) return out; } + // current cycle phase + static int cycle_phase_ind = find_signal_index( "current cycle phase index" ); + if( index == cycle_phase_ind ) + { + out = pCell->phenotype.cycle.current_phase_index(); + out /= signal_scales[index]; + return out; + } + // mechanical pressure static int pressure_ind = find_signal_index( "pressure" ); if( index == pressure_ind ) From 26c2a4d673ccb95b632bbb697aab3a9b10a6ccc8 Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Mon, 25 Aug 2025 13:15:45 -0400 Subject: [PATCH 3/3] fix bug --- core/PhysiCell_signal_behavior.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/PhysiCell_signal_behavior.cpp b/core/PhysiCell_signal_behavior.cpp index b46fb2705..f2a108593 100644 --- a/core/PhysiCell_signal_behavior.cpp +++ b/core/PhysiCell_signal_behavior.cpp @@ -884,7 +884,7 @@ std::vector get_signals( Cell* pCell ) // number of spring attachments static int num_spring_attachments_ind = find_signal_index( "number of spring attachments"); - signals[num_spring_attachments_ind] = pCell->state.spring_attached_cells.size + signals[num_spring_attachments_ind] = pCell->state.spring_attachments.size(); // damage static int damage_ind = find_signal_index( "damage");