Hello All,
I want to create a histogram input datafile. However, I have a couple of ambiguities in understanding histogram mode.
1- In table 2, page 34 of the documentation, what is “Amount of data in the histogram (TOF) bin” parameter? I do not know how this parameter is calculated?
2- For simplicity, let’s assume that we do not have attenuation, random, scatter and normalization factors. Only we record the crystal IDs (even no TOF). As a histogram mode, the name histogram makes me think that each data channel (i.e, the line connecting two crystals, crystal1 and crsytal2) appears only once in the datafile with the number of events (counts) for the channel. So, if we imagine that the datafile is recorded line by line, then loosely speaking, it should look like as follows where there is only one line in the whole datafile that contains “ID_crystal1 ID_crystal2”.
.
.
.
time num_counts(=amout of data) ID_crystal1 ID_crystal2
.
.
.
But, from table 2 and the code in “iDataFilePET.cc” (, and even since we are recording time), it looks like that the histogram datafile does not look like what I had in mind and it is written in a way that “ID_crystal1 ID_crystal2” might appear in two different lines in the datafile. Look at the code snippet below taken from “iDataFilePET.cc”.
int iDataFilePET::WriteHistoEvent(iEventHistoPET* ap_Event, int a_th)
{
/*
some code
*/
uint32_t time = ap_Event->GetTimeInMs();
m2p_dataFile[a_th]->write(reinterpret_cast<char*>(&time), sizeof(uint32_t));
/*
some code
*/
for(int b=0 ; b<m_nbTOFBins ; b++)
{
FLTNBDATA event_value = ap_Event->GetEventValue(b);
m2p_dataFile[a_th]->write(reinterpret_cast<char*>(&event_value), sizeof(FLTNBDATA));
if(m_scatCorrectionFlag)
{
FLTNBDATA scat_rate = ap_Event->GetEventScatRate(b);
m2p_dataFile[a_th]->write(reinterpret_cast<char*>(&scat_rate), sizeof(FLTNBDATA));
}
}
uint16_t nb_lines = ap_Event->GetNbLines();
// Write the number of lines only if the m_maxNumberOfLinesPerEvent is above 1
if (m_maxNumberOfLinesPerEvent>1) m2p_dataFile[a_th]->write(reinterpret_cast<char*>(&nb_lines), sizeof(uint16_t));
for(int i=0 ; i<nb_lines ; i++)
{
uint32_t id1 = ap_Event->GetID1(i);
uint32_t id2 = ap_Event->GetID2(i);
m2p_dataFile[a_th]->write(reinterpret_cast<char*>(&id1), sizeof(uint32_t));
m2p_dataFile[a_th]->write(reinterpret_cast<char*>(&id2), sizeof(uint32_t));
}
// Custom fields
/*
some code
*/
return 0;
}
However, in this case except for “Amount of data in the histogram (TOF) bin”, histogram and list mode datafiles are similar. Can you please help me to understand this concept and how to write a histogram data file? I generate each event and then record its information. I do this for list-mode without any problem, however, I am not sure how to do it for the histogram mode.
Thank,
Seyyed