Subversion Repositories f9daq

Rev

Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed

//
// ********************************************************************
// * License and Disclaimer                                           *
// *                                                                  *
// * The  GAMOS software  is  copyright of the Copyright  Holders  of *
// * the GAMOS Collaboration.  It is provided  under  the  terms  and *
// * conditions of the GAMOS Software License,  included in the  file *
// * LICENSE and available at  http://fismed.ciemat.es/GAMOS/license .*
// * These include a list of copyright holders.                       *
// *                                                                  *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work  make  any representation or  warranty, express or implied, *
// * regarding  this  software system or assume any liability for its *
// * use.  Please see the license in the file  LICENSE  and URL above *
// * for the full disclaimer and the limitation of liability.         *
// *                                                                  *
// * This  code  implementation is the result of  the  scientific and *
// * technical work of the GAMOS collaboration.                       *
// * By using,  copying,  modifying or  distributing the software (or *
// * any work based  on the software)  you  agree  to acknowledge its *
// * use  in  resulting  scientific  publications,  and indicate your *
// * acceptance of all terms of the GAMOS Software license.           *
// ********************************************************************
//

#ifndef PETProjDataMgr_h
#define PETProjDataMgr_h

/*---------------------------------------------------------------------------  
ClassName:   PETProjDataMgr
Author:      M. Canadas, P. Arce
Changes:     01/11: creation

-------------------------------------------------------------------------
// Description
         
    PET output (List-mode X Y Z) into projection data (sinograms).

    Output data: Sinograms for PET image reconstruction. Interfile format, STIR compatible (.hs/.s),
                 STIR Software for Tomographic Image Reconstruction: http://stir.sourceforge.net/main.htm    

-----------------------------------------------------------------------*/


#include <iostream>
#include "TVector3.h"
class TH2F;

//#include <math.h>
#include <map>
#include <vector>
#include <set>
#include <string>

class TH1;
class TH2F;
class TH3F;
class TRandom3;

 typedef unsigned short SINO_TYPE;  //!!NOTE:  Check "Write_sino3D" (.hv file) if SINO_TYPE changes !!

//------------------------------------------------------------------------
class PETProjDataMgr
{
 private:
  PETProjDataMgr();
  int m_Debug;
 public:
  ~PETProjDataMgr();

  //! Get the only instance
  static PETProjDataMgr* GetInstance();
  void AddEvent(const TVector3& pos1, const TVector3& pos2);
  //void ReadFile();
  //PETOutput ReadEvent( G4bool& bEof );
  void SetProjection(int axialplane, TH2F*h);
  void WriteInterfile();
  void SetNPlanes(int n){m_NOfPlanes=n;};
  void SetNBin(int n){m_NOfBins=n;};
  void SetNAng(int n){m_NOfAngles=n;};
  void SetDebug(int n){m_Debug=n;};
  void SetNumberOfChannels(int n){m_nch=n;};
  void SetFilename( const char *fname){ m_Filename= TString(fname); };
  void SetRingDiameter( double x){ m_RingDiameter = x; };
  void SetAxialDistance( double x){ m_AxialDistance = x; };
  TH2F *Phantom(int kaj);
  int FwdProject(TH2F *img, TH2F *h=NULL);
  int FwdProject(TH3F *img, TH3F *h=NULL);

  int FwdProject(double x,double y, double z, int nmax, TH1 *h=NULL);
  TVector3 Hits2Digits(const TVector3 &r);

private:
  static PETProjDataMgr* m_Instance;
 
  double m_AxialDistance;
  double m_RingDiameter;
  int m_NOfPlanes;
  int m_NOfBins;
  int m_NOfAngles;
  int m_MaxRingDifference;
  int m_OutFormat;
  int m_nch;
  int m_TotalAxialPlanes;
  TString m_Filename;
  TRandom3 * m_rnd;
  //G4bool bDumpCout;
 
  SINO_TYPE ***m_projections;
  SINO_TYPE *m_Buffer;
 
  unsigned long int m_TotalCoincidences;
  unsigned long int m_TotalProjectionCoincidences;

 
  FILE *fp;
};

#endif