ivoflipse / Pawlabeling

Tool for processing and analyzing pressure measurements
Other
18 stars 1 forks source link

Allow users to add plate configurations #74

Closed ivoflipse closed 10 years ago

ivoflipse commented 10 years ago

I'm working on adding more transparent settings and one of the options I'm adding allows for users to add their own plate, so the software knows what its dealing with.

default_value = [{"brand": "rsscan",
                          "model": "2m 2nd gen",
                          "frequency": 125,
                          "sensor_width": 0.508,
                          "sensor_height": 0.762,
                          "sensor_surface": 0.387096
                         },
                         {"brand": "zebris",
                          "model": "FDM 1m",
                          "frequency": 200,
                          "sensor_width": 0.846,
                          "sensor_height": 0.846,
                          "sensor_surface": 0.715716
                         },
                         {"brand": "novel",
                          "model": "emed",
                          "frequency": 100,
                          "sensor_width": 0.5,
                          "sensor_height": 0.5,
                          "sensor_surface": 0.25
                         }
        ]

But now we need to change the way the measurement widget fills in its values, as users should select one of these (possibly self-created) templates, rather than fiddle with individual values.

Also, these values are really opaque to access, as its not clear which plate/model is currently selected, so this information needs to be broadcasted, so relevant widgets can update and calculations can adjust things like sensor_surface and frequency.

I'm not sure whether I should include frequency like that, since this can/will vary, even though all other variables will remain the same. Its rather unnecessary to create separate entities for each unique combination.

ivoflipse commented 10 years ago

Well the current way clearly isn't working. Perhaps if I provide some UI element to create a plate configuration by offering choices or input fields for the different parts it could work, but the way they are created now, they can't really be stored in the settings, because I have no clue what key to give to each configuration.

Furthermore, even the way they are stored now require changes to the measurementwidget, because I can't set the brand/model/frequency separately anymore.

A possible solution is to add setter/getter functions for the 5 components, but have a lookup table elsewhere (possibly pytables) that loads the different configurations.

ivoflipse commented 10 years ago

I've decided to store them in PyTables instead, so here's the definition of the plate I've come up so far:

class PlatesTable(tables.IsDescription):
    brand = tables.StringCol(32)
    model = tables.StringCol(32)
    frequency = tables.Int16Col()
    width = tables.Int16Col()
    height = tables.Int16Col()
    sensor_width = tables.Float16Col()
    sensor_height = tables.Float16Col()
    sensor_surface = tables.Float16Col()

The 'good' thing is that I could use this information to pre-allocate frame buffers when loading the measurements, because I should know what size to expect. This does mean that one should report the number of sensors in the export, not the number of sensors the plate might have (I'm looking at your footscan!).

This means the model will be responsible for managing these, though I might put them in a module of their own.

ivoflipse commented 10 years ago

I've added an ID to the PlatesTable, such that the fields from measurement are removed and they just point to the plate_id. However, this has the consequence that whenever you export measurements, you better be sure to export the plate information that goes with it or else...

To make sure at least some systems are accounted for, I'm going to add a function to Settings which will fill the PlatesTable with several systems from RSscan and Zebris.

ivoflipse commented 10 years ago

So as it stands now you pick one of the plates I created in Settings, which should cover most. For now I'll just add them manually if anything is missing.

Then you pick the plate from a combobox on the measurements_widget and set the frequency. The measurement keeps track of the plate_id it was supposedly measured with and it will remember the frequency. That way frequencies can vary for the same plate.

The application doesn't use information about the plate's dimensions or frequency just yet, but it might in the future. For now, this is closed.