Display additional fields in detailed fluoroscopy view
I'd like to add columns to the detailed event table in rfdetail.html
for the following:
- Secondary angle (primary angle is already displayed). Need to amend title for primary angle to include the word
primary
too. - Pulse rate
- Dose at reference point
These could be added by including the following lines in the appropriate place in the file, together with suitable additions for the column headings:
<td>{{ event.irradeventxraymechanicaldata_set.get.positioner_secondary_angle|floatformat:1 }}</td> <td>{{ event.irradeventxraysourcedata_set.get.pulse_rate|floatformat:2 }}</td> <td>{{ event.irradeventxraysourcedata_set.get.dose_rp|floatformat:2 }}</td>
(Note: dose_rp
is stored in the database as Gy - can is there a built-in conversion in OpenREM to display this as mGy?)
Comments (18)
-
reporter -
What also would be great is to see acquisition type in the table (fluoroscopic, static acquisition, rotational acquisition)
Also in the header information it would be nice if you could see how much of the DAP and Dose is caused by fluoroscopic runs and how much by acquisitions:
- Total DAP, Single Plane: 1.9 cGy.cm2 (fluoro: 1.3, acquisitions: 0.6)
- Total dose at RP, Single Plane: 1.90 Gy (fluoro: 1.3, acquisitions: 0.6)
-
reporter @LuukO, I agree - I'll add those features too.
-
reporter There are four possible irradiation event types defined at the moment (http://dicom.nema.org/MEDICAL/Dicom/2015c/output/chtml/part16/sect_CID_10002.html):
- Fluoroscopy
- Stationary Acquisition
- Stepping Acquisition
- Rotational Acquisition
I could calculate the total DAP and dose at reference point for each of these in
rf_detail_view
withinviews.py
each time the user selects a study.Alternatively these values could be calculated at import and stored in the database.
The easy option for me now is too add code to
rf_detail_view
that calculates these values each time they are needed. -
reporter Added additional fields to table on
rfdetail.html
page:irradiation_event_type
,pulse_rate
,positioner_secondary_angle
anddose_rp
(in mGy). Need to add the display of DAP and dose at RP for each irradiation event type. References issue#497→ <<cset dd15a600341b>>
-
reporter I think I should be able to annotate the DAP sum for each irradiation type to the objects corresponding to the required study, but it doesn't work: I just get a single total DAP. Any thoughts on how to do this anyone? The code below would go in
rf_detail_view
withinviews.py
instead of the simplestudy = GeneralStudyModuleAttr.objects.get(pk=pk)
line:from django.db.models import Sum testing = GeneralStudyModuleAttr.objects.filter(pk=pk).annotate(sum_dap = Sum('projectionxrayradiationdose__irradeventxraydata__dose_area_product')).order_by('projectionxrayradiationdose__irradeventxraydata__irradiation_event_type')
PS: I have since realised that the above code does work
-
reporter Added code to calculate and display DAP and dose at reference point for each irradiation type (fluoro, stationary acquisition etc). Works fine, but at the moment the values aren't formatted (loads of decimal places) and I think the code is a bit ugly. Happy to accept suggestions as to how to improve it. References issue
#497→ <<cset 062b57861dd9>>
-
reporter Modified code so that I can format the total DAP and reference point dose values. These are now formatted in a similar way to the study totals on the same page. The dose at reference point per irradiation type is shown with three significant figures. The DAP totals for each irradiation type are shown with two decimal places. References issue
#497→ <<cset c325e23f2ed4>>
-
reporter Changed display of DAP and dose at RP in detail table to use three significant figures. References issue
#497→ <<cset af80b5634cca>>
-
reporter - changed status to resolved
Updated changes files. References and fixes issue
#497→ <<cset 3d098fa7d27c>>
-
Reformatted header row to make it comprehensible. Refs
#497→ <<cset 04e43e064a5d>>
-
reporter - changed status to open
I'd like to include the total exposure time for each type of irradiation event, in addition to the DAP and dose at reference point. This can easily be added to the existing table.
-
reporter In
view.py
therf_detail_view
code needs to be changed to:try: study = GeneralStudyModuleAttr.objects.get(pk=pk) stu_inc_totals = GeneralStudyModuleAttr.objects.filter(pk=pk).annotate( sum_dap = Sum('projectionxrayradiationdose__irradeventxraydata__dose_area_product')*1000000, sum_dose_rp = Sum('projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__dose_rp') ).order_by('projectionxrayradiationdose__irradeventxraydata__irradiation_event_type') stu_dose_totals = stu_inc_totals.values_list('sum_dap', 'sum_dose_rp').order_by('projectionxrayradiationdose__irradeventxraydata__irradiation_event_type') stu_irr_types = stu_inc_totals.values_list('projectionxrayradiationdose__irradeventxraydata__irradiation_event_type__code_meaning').order_by('projectionxrayradiationdose__irradeventxraydata__irradiation_event_type').distinct() stu_time_totals = [None] * len(stu_irr_types) for idx, irr_type in enumerate(stu_irr_types): stu_time_totals[idx] = GeneralStudyModuleAttr.objects.filter(pk=pk, projectionxrayradiationdose__irradeventxraydata__irradiation_event_type__code_meaning= irr_type[0]).aggregate( Sum('projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__exposure_time')).values()[0] / 1000 study_totals = np.column_stack((stu_irr_types, stu_dose_totals, stu_time_totals)).tolist()
and the table in
rfdetail
needs to be:<table class="table table-condensed table-bordered small"> <th>Irradiation type</th><th>Total DAP (cGy.cm<sup>2</sup>)</th><th>Total dose at RP (Gy)</th><th>Total time (s)</th> {% for irr_type in study_totals %} <tr> <td>{{ irr_type.0 }}</td> <td><script>document.write({{ irr_type.1 }}.toFixed(2));</script></td> <td><script>document.write({{ irr_type.2 }}.toPrecision(3));</script></td> <td><script>document.write({{ irr_type.3 }}.toFixed(2));</script></td> </tr> {% endfor %} </table>
-
reporter Added display of total exposure time for each type of irradiation event to the table on
rfdetail.html
. References issue#497→ <<cset 41423eba4edb>>
-
reporter Merged in issue497ExtraFluoroDetails (pull request #112)
Added display of total exposure time for each type of irradiation event to the table on
rfdetail.html
. References issue#497Approved-by: Ed McDonagh ed@mcdonagh.org.uk
→ <<cset d5c29f95f459>>
-
@dplatten - I think this might be fixed? Can you cast your eye over it and if it is, change the assignee to yourself and mark it fixed/closed?
Thanks
-
reporter -
assigned issue to
-
assigned issue to
-
reporter - changed status to resolved
This issue has been resolved and the code merged in to develop.
- Log in to comment
Add a new function to the
IrradEventXRaySourceData
class inmodels.py
to allow display ofdose_rp
in mGy in the web interface:Then in the template use the following line: