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>
107 virtual void clear();
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>
221 if (normal_moments.size() != (
Size)moment_number)
222 computeAllMoments(moment_number);
227 for (
int current_moment=0; current_moment<moment_number; current_moment++)
228 diff += fabs(normal_moments[current_moment] - spectrum.
normal_moments[current_moment]);
233 template <
typename DataT,
typename PeakT,
typename PositionT>
236 if (central_moments.size() != (
Size)moment_number)
237 computeAllMoments(moment_number);
242 for (
int current_moment=0; current_moment<moment_number; current_moment++)
243 diff += fabs(central_moments[current_moment] - spectrum.
central_moments[current_moment]);
248 template <
typename DataT,
typename PeakT,
typename PositionT>
251 if (standardized_moments.size() != (
Size)moment_number)
252 computeAllMoments(moment_number);
257 for (
int current_moment=0; current_moment<moment_number; current_moment++)
258 diff += fabs(standardized_moments[current_moment] - spectrum.
standardized_moments[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>
281 return Hu_invariants_;
284 template <
typename DataT,
typename PeakT,
typename PositionT>
287 return Hu_invariants_;
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)
virtual std::vector< PeakType > getSticks() 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 PositionType getSpacing() const
virtual double getCentralMomentsDifference(Spectrum< DataT, PeakT, PositionT > &spectrum, int moment_number)
BALL_EXPORT LogStream Log
const std::vector< float > & getHuInvariants() const
const DataType & getData() const
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 earthMoversDistance(const Spectrum< DataT, PeakT, PositionT > &spectrum) const
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
std::vector< float > central_moments
precomputed central moments
virtual void computeAllMoments(int moment_number)
Spectrum< RegularData1D, Peak1D > Spectrum1D
One-dimensional spectrum.
virtual void clearSticks()
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.
std::vector< float > Hu_invariants_
virtual double difference(const Spectrum< DataT, PeakT, PositionT > &spectrum) const
Spectrum< RegularData3D, Peak3D > Spectrum3D
Three-dimensional spectrum.
virtual double getAbsIntegral() const