7 #ifndef BALL_NMR_SPECTRUM_H 8 #define BALL_NMR_SPECTRUM_H 10 #ifndef BALL_NMR_PEAKLIST_H 14 #ifndef BALL_DATATYPE_REGULARDATA1D_H 18 #ifndef BALL_DATATYPE_REGULARDATA2D_H 22 #ifndef BALL_DATATYPE_REGULARDATA3D_H 28 #ifndef BALL_MATHS_FFT1D_H 31 #ifndef BALL_MATHS_FFT2D_H 45 template <
typename DataT,
typename PeakT,
typename PositionT =
typename PeakT::Position>
85 Spectrum(
const std::vector<PeakType>& peaks,
const PositionType& origin,
const PositionType& dimension,
const PositionType& spacing)
96 const DataType&
getData()
const;
107 virtual void clear();
117 virtual void setSpacing(
const PositionType& spacing);
169 template <
typename DataT,
typename PeakT,
typename PositionT>
176 template <
typename DataT,
typename PeakT,
typename PositionT>
186 template <
typename DataT,
typename PeakT,
typename PositionT>
195 template <
typename DataT,
typename PeakT,
typename PositionT>
203 template <
typename DataT,
typename PeakT,
typename PositionT>
212 template <
typename DataT,
typename PeakT,
typename PositionT>
218 template <
typename DataT,
typename PeakT,
typename PositionT>
227 for (
int current_moment=0; current_moment<moment_number; current_moment++)
233 template <
typename DataT,
typename PeakT,
typename PositionT>
242 for (
int current_moment=0; current_moment<moment_number; current_moment++)
248 template <
typename DataT,
typename PeakT,
typename PositionT>
257 for (
int current_moment=0; current_moment<moment_number; current_moment++)
263 template <
typename DataT,
typename PeakT,
typename PositionT>
269 template <
typename DataT,
typename PeakT,
typename PositionT>
278 template <
typename DataT,
typename PeakT,
typename PositionT>
284 template <
typename DataT,
typename PeakT,
typename PositionT>
292 template <
typename DataT,
typename PeakT,
typename PositionT>
295 Log.
error()<<
"computeHuInvariants() only implemented in 2D" << std::endl;
299 template <
typename DataT,
typename PeakT,
typename PositionT>
302 Log.
error()<<
"computeHuInvariantsDifferences() only implemented in 2D" << std::endl;
303 std::vector<float> result;
307 template <
typename DataT,
typename PeakT,
typename PositionT>
310 Log.
error() <<
"getFourierDifference only implemented in 1D and 2D" << std::endl;
328 template <
typename DataT,
typename PeakT,
typename PositionT>
329 std::ostream& operator << (std::ostream& os, const Spectrum<DataT, PeakT, PositionT>& spectrum);
331 template <
typename DataT,
typename PeakT,
typename PositionT>
334 # ifndef BALL_NO_INLINE_FUNCTIONS 335 # include <BALL/NMR/spectrum.iC> 340 #endif // BALL_NMR_SPECTRUM_H virtual double getNormalMomentsDifference(Spectrum< DataT, PeakT, PositionT > &spectrum, int moment_number)
virtual void convertToGaussian()
Spectrum(const DataType &data)
const std::vector< float > & getHuInvariants() const
virtual double earthMoversDistance(const Spectrum< DataT, PeakT, PositionT > &spectrum) const
const DataType & getData() const
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
std::vector< float > standardized_moments
precomputed standardized moments
PositionT PositionType
the data type used to store a position (for peaks and data)
virtual double getStandardizedMomentsDifference(Spectrum< DataT, PeakT, PositionT > &spectrum, int moment_number)
std::vector< PeakType > sticks_
virtual double getCentralMomentsDifference(Spectrum< DataT, PeakT, PositionT > &spectrum, int moment_number)
virtual PositionType getSpacing() const
BALL_EXPORT LogStream Log
DataT::ConstIterator ConstIterator
A constant iterator.
virtual void setSticks(std::vector< PeakType > sticks)
void binaryRead(const String &filename)
This function requires that DataT has a binaryRead method.
PeakT PeakType
The peak type.
virtual double getFourierDifference(const Spectrum< DataT, PeakT, PositionT > &spectrum, float min_freq=1e6, float max_freq=-1e6)
virtual void computeHuInvariants()
Spectrum(const std::vector< PeakType > &peaks, const PositionType &origin, const PositionType &dimension, const PositionType &spacing)
virtual void convertToLorentzian()
virtual Spectrum< DataT, PeakT, PositionT > differenceSpectrum(const Spectrum< DataT, PeakT, PositionT > &spectrum)
LogStream & error(int n=0)
virtual std::vector< float > computeHuInvariantsDifferences(std::vector< Spectrum< DataT, PeakT, PositionT > > &spectra)
std::vector< float > normal_moments
precomputed normal moments
virtual double getAbsIntegral() const
std::vector< float > central_moments
precomputed central moments
virtual void computeAllMoments(int moment_number)
Spectrum< RegularData1D, Peak1D > Spectrum1D
One-dimensional spectrum.
virtual void clearSticks()
-*- Mode: C++; tab-width: 2; -*-
void binaryWrite(const String &filename)
This function requires that DataT has a binaryWrite method.
virtual void setSpacing(const PositionType &spacing)
DataT DataType
The datatype used to store the spectrum.
BALL_INLINE TAngle< T > operator-(const T &val, const TAngle< T > &angle)
Spectrum< RegularData2D, Peak2D > Spectrum2D
Two-dimensional spectrum.
DataT::Iterator Iterator
An iterator.
virtual double difference(const Spectrum< DataT, PeakT, PositionT > &spectrum) const
std::vector< float > Hu_invariants_
Spectrum< RegularData3D, Peak3D > Spectrum3D
Three-dimensional spectrum.
virtual std::vector< PeakType > getSticks() const