Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • f99a844
  • /
  • lib
  • /
  • OxCalculatorT1.h
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:846fa6f60dddd34f235ad62b7b8b4240103f4c46
directory badge Iframe embedding
swh:1:dir:7f21c9a4b7dfafd29925be862d8bd559b684364d
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
OxCalculatorT1.h
/*!
 * \file OxCalculator.h
 * \author Konrad Werys
 * \date 2018/07/29
 */

#ifndef Tomato_OXCALCULATORT1_H
#define Tomato_OXCALCULATORT1_H

#include "OxCalculatorResults.h"
#include "OxFitter.h"
#include "OxFunctionsT1.h"
#include "OxSignCalculator.h"
#include "OxStartPointCalculator.h"

#include "KWUtil.h"

namespace Ox {

    /**
     * \class CalculatorT1
     * \brief
     * \details
     * @tparam MeasureType
     */
    template< typename MeasureType >
    class CalculatorT1{

    public:

        /**
         * do all the checks and  prepare to do the calculation, for example calc signal/signs and _TRRaverageHB
         * @return success/failure
         */
        virtual int prepareToCalculate();

        /**
         * the most important function of this class
         * @return success/failure
         */
        virtual int calculate() = 0;

        /* ****************** */
        /* ***  GETTERS   *** */
        /* ****************** */

        /**
         * /throw exception if _FunctionsT1 == 0
         * @return
         */
        FunctionsT1<MeasureType> *getFunctionsT1() const;

        /**
         * /throw exception if _Fitter == 0
         * @return
         */
        Fitter<MeasureType> *getFitter() const;

        /**
         * /throw exception if _StartPointCalculator == 0
         * @return
         */
        StartPointCalculator<MeasureType> *getStartPointCalculator() const;

        /**
         * /throw exception if _SignCalculator == 0
         * @return
         */
        SignCalculator<MeasureType> *getSignCalculator() const;

        /**
         * /throw exception if _InvTimes == 0
         * @return
         */
        const MeasureType *getInvTimes() const;

        //const MeasureType *getEchoTimes() const;

        const MeasureType *getRepTimes() const;

        const MeasureType *getRelAcqTimes() const;

        /**
         * /throw exception if _SigMag == 0
         * @return
         */
        const MeasureType *getSigMag() const;

        /**
         * does not have to be set
         * @return SigPha pointer, can be 0 (NULL)
         */
        const MeasureType *getSigPha() const;

        MeasureType *getSignal() const;

        MeasureType *getSigns() const;

        MeasureType * getStartPoint() ;

        const CalculatorT1Results<MeasureType> getResults() const;

        MeasureType getMeanCutOff() const;

        /**
          * /throw exception if _nSamples == 0
          * @return
          */
        int getNSamples() const;

        /**
          * /throw exception if _nDims == 0
          * @return
          */
        int getNDims() const;


        /* ****************** */
        /* ***  SETTERS   *** */
        /* ****************** */

        // setters for the 'has a' classes
        void setFunctionsT1(FunctionsT1<MeasureType> *_FunctionsT1);

        void setFitter(Fitter<MeasureType> *_Fitter);

        void setSignCalculator(SignCalculator<MeasureType> *_SignCalculator);

        void setStartPointCalculator(StartPointCalculator<MeasureType> *_StartPointCalculator);

        // setters for the data
        virtual void setInvTimes(const MeasureType *_InvTimes);

        virtual void setSigMag(const MeasureType *_SigMag);

        virtual void setSigPha(const MeasureType *_SigPha);

        virtual void setMeanCutOff(MeasureType _MeanCutOff);

        /**
         * _Signal and _Signs are allocated here!!!
         * @param _nSamples
         */
        virtual void setNSamples(int _nSamples);

        /**
         * _StartPoint is allocated here!!!
         * @param _nDims
         */
        virtual void setNDims(int _nDims);

        /**
         * \brief show me your FunctionsT1
         */
        void disp();

        /**
         * \brief set all the pointers to zero
         */
        void setAllPointersToNull(){
            // objects
            _FunctionsT1 = 0;
            _Fitter = 0;
            _SignCalculator = 0;
            _StartPointCalculator = 0;

            // arrays
            _InvTimes = 0;
            //_EchoTimes = 0;
            _RepTimes = 0;
            _RelAcqTimes = 0;
            _SigMag = 0; // original one
            _SigPha = 0; // original one
            _Signal = 0; // we will be working with this one
            _Signs = 0;  // we will be working with this one
            _StartPoint = 0;
        }

        /**
         * \brief constructor
         */
        CalculatorT1() {

            setAllPointersToNull();

            // primitives
            _MeanCutOff = 0;
            _nSamples = 0;
            _nDims = 0;

        };

        /**
         * \brief copy constructor
         */
        CalculatorT1(const CalculatorT1 &old){

            setAllPointersToNull();

            // primitives
            setMeanCutOff(old._MeanCutOff);
            setNSamples(old._nSamples);
            setNDims(old._nDims);
        };

        /**
         * cloning
         * @return
         */
        virtual CalculatorT1<MeasureType> *newByCloning() = 0;

        /**
         * \brief do not forget about the virtual destructor, see
         * https://stackoverflow.com/questions/461203/when-to-use-virtual-destructors
         */
        virtual ~CalculatorT1(){
            //std::cout << "in ~CalculatorT1" << std::endl;
            delete [] _Signal; _Signal = 0;
            delete [] _Signs; _Signs = 0;
            delete [] _StartPoint; _StartPoint = 0;
         };

    protected:
        CalculatorT1Results<MeasureType> _Results; // we will be working with this one

        FunctionsT1<MeasureType>* _FunctionsT1;
        Fitter<MeasureType>* _Fitter;
        SignCalculator<MeasureType>* _SignCalculator;
        StartPointCalculator<MeasureType>* _StartPointCalculator;

        const MeasureType* _InvTimes;
        //const MeasureType* _EchoTimes;
        const MeasureType* _RepTimes;
        const MeasureType* _RelAcqTimes;
        const MeasureType* _SigMag; // original one
        const MeasureType* _SigPha; // original one
        MeasureType* _Signal; // size: nSamples. We will be working with this one
        MeasureType* _Signs;  // size: nSamples. We will be working with this one
        MeasureType* _StartPoint; // size: nDims. We will be working with this one

        int _nSamples;
        int _nDims;
        MeasureType _MeanCutOff;

        const static int MAX_T1_TRESHOLD = 4000;

    };
} //namespace Ox

#include "OxCalculatorT1.hxx"

#endif //Tomato_OXCALCULATORT1_H

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top