# What is the format/syntax for the "modifier\_file" in the modification classes?

**URL:** https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480
**Category:** Pulse Physiology Engine
**Created:** [March 28, 2025, 6:38pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480 "2025-03-28T18:38:51Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![ezcawi](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/e/ecb155/32.png) [@ezcawi](https://discourse.kitware.com/u/ezcawi)
#### Post date: [March 28, 2025, 6:38pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/1 "2025-03-28T18:38:51Z")

</div>

Hello! I am looking to modify the Cerebral Perfusion Pressure in my pulse simulation by adding/subtracting values. There’s a class, “SECardiovascularMechanicsModification”, used to modify the cardiovascular system [here:](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/python/pulse/cdm/patient_actions.py?ref_type=heads) which uses a set of default examples, but also has a method to take in a modifier file.

What is the syntax of that file and what are the limits of what parameters can be modified? I haven’t been able to find any documentation or examples using a custom modifier file on the github. Thanks!

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [March 28, 2025, 8:05pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/2 "2025-03-28T20:05:45Z")

</div>

Modification of the system can be done via this action by filling out a [SECardiovascularMechanicsModifiers](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/python/pulse/cdm/physiology.py?ref_type=heads#L25) object in the action, or a filename of a file containing the json of this object.

While we do provide a method to [serialize that object to its protobuf binding object](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/python/pulse/cdm/io/physiology.py?ref_type=heads#L13), we don’t seem to have the 2 methods to turn that binding object to a string, then to a file. You could easily write those [based on these 2 methods on the SEPatient](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/python/pulse/cdm/io/patient.py?ref_type=heads#L13)

Then when you can create modifier objects and serialize those to file, and refer to those file paths in the action instead.

We have not really tested the limits of the modifiers, this functionality is still a work in progress.  
[We have tested modification from 0.5 to 2.0 here](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/cpp/howto/HowTo-CardiovascularModification.cpp?ref_type=heads#L90)

The file based modifiers has not been tested either, but [the code seems to be there](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/cpp/cdm/patient/actions/SECardiovascularMechanicsModification.cpp?ref_type=heads#L43)…

---

<div class="post-metadata">

### Author: ![ezcawi](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/e/ecb155/32.png) [@ezcawi](https://discourse.kitware.com/u/ezcawi)
#### Post date: [March 28, 2025, 8:47pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/3 "2025-03-28T20:47:53Z")

</div>

Thank you for replying! As a clarification, I want to add a new type of modification to the set of available modifications, and am wondering how deep into pulse I need to go to implement that?

My current thoughts are to:

1. Add a “has\_CPP\_modifier” and “get\_CPP\_modifier” to [physiology.py](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/python/pulse/cdm/physiology.py?ref_type=heads#L25)
2. Modify my python script to set the value of my CPP modifier.
3. Modify CardiovascularModel.cpp after line 1238 to check for any modifiers and set our value appropriately

Before I went fully into the weeds on the model, I figured I should check if there are other modifications that will need to be made to pulse deeper in the code or if that approach is solid.

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [March 28, 2025, 9:01pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/4 "2025-03-28T21:01:25Z")

</div>

In order to support all the interaction between various coding laguages, we use Protobuf as the schema definition language for our data model.

So you would:

1. Modify [the schema object](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/schema/pulse/cdm/bind/Physiology.proto?ref_type=heads#L76)
2. Update the C++ [Header](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/cpp/cdm/system/physiology/SECardiovascularMechanicsModifiers.h?ref_type=heads) and [Class](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/cpp/cdm/system/physiology/SECardiovascularMechanicsModifiers.cpp?ref_type=heads) as well as its binding translation [to](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/cpp/cdm/io/protobuf/PBPhysiology.cpp?ref_type=heads#L166) and [from](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/cpp/cdm/io/protobuf/PBPhysiology.cpp?ref_type=heads#L196) methods
3. Update the python [class](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/python/pulse/cdm/physiology.py?ref_type=heads#L25) and its binding translation [to](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/python/pulse/cdm/io/physiology.py?ref_type=heads#L13)
4. (Update Java and C#, but we can skip those for now)
5. Use m\_MechanicsModifiers with your new property where you need to in CardiovascularModel

---

<div class="post-metadata">

### Author: ![ezcawi](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/e/ecb155/32.png) [@ezcawi](https://discourse.kitware.com/u/ezcawi)
#### Post date: [March 28, 2025, 9:03pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/5 "2025-03-28T21:03:36Z")

</div>

Thanks!

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [March 28, 2025, 9:06pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/6 "2025-03-28T21:06:36Z")

</div>

Between 1 and 2, you should manually regenerate the protobuf bindings using the [run command](https://gitlab.kitware.com/physiology/engine/-/wikis/Test%20Suite)

`run protoc`

Look for any errors…

---

<div class="post-metadata">

### Author: ![ezcawi](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/e/ecb155/32.png) [@ezcawi](https://discourse.kitware.com/u/ezcawi)
#### Post date: [April 3, 2025, 5:53pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/7 "2025-04-03T17:53:33Z")

</div>

Thanks again for your responses!  
Does processing the action to modify the CPP bypass CPP autoregulation, or is that handled in the stabilization step?

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [April 3, 2025, 7:12pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/8 "2025-04-03T19:12:44Z")

</div>

I am not sure what you mean by autoregulation

You have to either stabilize or load an engine state file before you can process any actions

If you stabilize, you will call InitializeEngine which will not return until the engine is stable

The system will need to process the action each time step. After each time step the system is reset back to its basline values, and you will need to reapply the changes to the system based on the action, to the next values.

For example, you can see [here that we keep updating a path resistance every time step](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/cpp/engine/common/system/physiology/CardiovascularModel.cpp?ref_type=heads#L1750) when the system has an active hemorrhage action

---

<div class="post-metadata">

### Author: ![ezcawi](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/e/ecb155/32.png) [@ezcawi](https://discourse.kitware.com/u/ezcawi)
#### Post date: [April 8, 2025, 3:04pm UTC](https://discourse.kitware.com/t/what-is-the-format-syntax-for-the-modifier-file-in-the-modification-classes/1480/9 "2025-04-08T15:04:22Z")

</div>

I just meant that Cerebral Perfusion Pressure Autoregulation as the body’s attempt to keep a constant CPP despite changes in other pressures throughout the body.
