Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create STIR loop over listmode events #1

Closed
EveLMedPhys opened this issue Nov 13, 2023 · 6 comments
Closed

create STIR loop over listmode events #1

EveLMedPhys opened this issue Nov 13, 2023 · 6 comments

Comments

@EveLMedPhys
Copy link
Collaborator

roughly...

 shared_ptr<ListModeData> lm(stir::read_from_file<ListModeData>(filename));
  shared_ptr <ListRecord> record_sptr = lm_data_ptr->get_empty_record_sptr();
  ListRecord& record = *record_sptr;
 while(true)
{
		 if (lm_data_ptr->get_next_record(record) == Succeeded::no) 
		   {
		     // no more events in file for some reason
		     break; //get out of while loop
		   }
         if (record.is_time() )
		   {
		     current_time = record.time().get_time_in_secs();
                     // do something
		   }
		 if (record.is_event())
		   {
                     // going to bins, but probably best to use record.event().get_LOR()
		     Bin bin;
                     bin.time_frame_num() = current_frame_num;
                    get_bin_from_event(bin, record.event());
		     		       
		     // check if it's inside the range we want to store
		     if (bin.get_bin_value()>0
			    {
			   }
		       }
		   } // end of spatial event processing
	       } // end of while loop over all events

``
@ghost
Copy link

ghost commented Nov 13, 2023

@ghost
Copy link

ghost commented Nov 14, 2023

We need access to the empty records. Currently we can get a shared smart point to one via lm_data_ptr->get_empty_record_sptr(). However, we need to likely expend stir::ListModeData (in swig) to give us the following.

%extend stir::ListModeData {
    % Cut other methods...
    static ListRecord& get_empty_record()
    {
      using namespace stir;
      shared_ptr <ListRecord> record_sptr = lm_data_ptr->get_empty_record_sptr()
      return *record_sptr;
    }
}

@KrisThielemans
Copy link
Contributor

should just be

%shared_ptr(stir:ListRecord)
%include "stir/listmode/ListRecord.h"

somewhere here

@KrisThielemans
Copy link
Contributor

Actually, the listmode loop is documented in the stir::ListmodeData doxygen: https://github.com/UCL/STIR/blob/734a0d713df4318cea10f1a8ec5aea90ca093254/src/include/stir/listmode/ListModeData.h#L44

@KrisThielemans
Copy link
Contributor

See UCL/STIR#1288 (WIP)

@KrisThielemans
Copy link
Contributor

The STIR PR is merged. However, we could abandon the Python effort, so I'm going to close this.

KrisThielemans added a commit that referenced this issue Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants