Hi Folks
A couple of people here are working on a project that will involve some real time data analysis that will heavily employ MATLAB. To this end, they would like to have real time, or near real time access to data.
I have been trying to coax the real time plugin to write data out to disk after each volume is acquired and registered. In the RT_process_image function, I added some code after the "rtin->reg_mode" case-switch structure, i.e. after the RT_registration_2D_realtime and RT_registration_3D_realtime choices. I used the THD_copy_dset_subs function on either rtin->dset or rtin->reg_dset depending on if the user wanted the original data, or registered data in "real time", and just having that function access the last volume and try to write it out to disk. The added code looks something like:
switch ( RTdatamode )
{
case RT_WRITE_ACQUIRED:
{
RT_dset_written = THD_copy_dset_subs (rtin->dset[0], RT_sub_brick_id);
}
break ;
case RT_WRITE_REGISTERED:
{
RT_dset_written = THD_copy_dset_subs (rtin->reg_dset, RT_sub_brick_id);
}
break ;
#endif /* ALLOW_REGISTRATION */
}
sprintf (RT_written_prefix, "%s_%06d",
rtin->root_prefix,
RT_written);
fprintf (stdout, "Trying to write data set %s \n",
RT_written_prefix);
fflush (stdout);
EDIT_dset_items( RT_dset_written,
ADN_prefix , RT_written_prefix,
ADN_label1 , RT_written_prefix,
ADN_none ) ;
DSET_overwrite (RT_dset_written) ;
RT_written++ ;
However, THD_copy_dset_subs seems to be hitting the disk to get the data set info. I back tracked that function in thd_mastery.c and it looks like it checks to see if the data set is already in memory. Is this accurate ?
And is there a better path to get to where I am trying to go ? I was planning on giving what I did here back to the AFNI group to add into the code base if it worked well enough and robustly enough for us ...
Thanks all.
vinai