Say I have a dose-calculation function like this:
astroid::image_3d
compute_dose(...);
And I have a request "composer" that is able to compose the appropriate request
to compute the dose for a beam within a plan:
request_t<astroid::image_3d>
compose_dose_request_for_beam(...);
(I'm using request_t here as a stand-in for an actual CRADLE request type,
but hopefully the actually type isn't important to this...)
Now, a treatment plan has multiple beams. To compute the dose for a treatment
plan, we compute the dose for each beam and then add them up with this
function:
astroid::image_3d
add_images(std::vector<astroid::image_3d> images);
However, I think it's currently impossible in CRADLE to put all of this
together to write a function like this:
request_t<astroid_image_3d>
compose_dose_request_for_plan(treatment_plan const& plan);
The issue is that after composing the request for each beam, we end up with
something like a std::vector<request_t<astroid::image_3d>>, where there is
one entry per beam, but in order to compose the request to call add_images,
we need a request_t<std::vector<astroid::image_3d>>.
I wonder how hard it would be to add something like rq_vector that we can
apply in between:
rq_add_images(rq_vector(beam_dose_requests))
The signature of rq_vector is thus:
template<class Element>
cradle::request<std::vector<Element>>
rq_vector(std::vector<request_t<Element>>);
Say I have a dose-calculation function like this:
And I have a request "composer" that is able to compose the appropriate request
to compute the dose for a beam within a plan:
(I'm using
request_there as a stand-in for an actual CRADLE request type,but hopefully the actually type isn't important to this...)
Now, a treatment plan has multiple beams. To compute the dose for a treatment
plan, we compute the dose for each beam and then add them up with this
function:
However, I think it's currently impossible in CRADLE to put all of this
together to write a function like this:
The issue is that after composing the request for each beam, we end up with
something like a
std::vector<request_t<astroid::image_3d>>, where there isone entry per beam, but in order to compose the request to call
add_images,we need a
request_t<std::vector<astroid::image_3d>>.I wonder how hard it would be to add something like
rq_vectorthat we canapply in between:
rq_add_images(rq_vector(beam_dose_requests))The signature of
rq_vectoris thus: