Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #9115. Implement ConnectedComponentsLabelling with 1d tests.
Implement simple testing for connected component labelling.
- Loading branch information
1 parent
8da661a
commit 7228a39
Showing
18 changed files
with
625 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Code/Mantid/Framework/Crystal/inc/MantidCrystal/BackgroundStrategy.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#ifndef BACKGROUNDSTRATEGY_H_ | ||
#define BACKGROUNDSTRATEGY_H_ | ||
|
||
namespace Mantid | ||
{ | ||
namespace API | ||
{ | ||
class IMDIterator; | ||
} | ||
namespace Crystal | ||
{ | ||
/** BackgroundStrategy : Abstract class used for identifying elements of a IMDWorkspace that are not considered background. | ||
Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class BackgroundStrategy | ||
{ | ||
public: | ||
virtual bool isBackground(Mantid::API::IMDIterator* const iterator) const = 0; | ||
virtual void configureIterator(Mantid::API::IMDIterator* const iterator) const = 0; | ||
virtual ~BackgroundStrategy() | ||
{ | ||
} | ||
}; | ||
} | ||
} | ||
#endif /* BACKGROUNDSTRATEGY_H_ */ |
52 changes: 52 additions & 0 deletions
52
Code/Mantid/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabelling.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifndef MANTID_CRYSTAL_CONNECTEDCOMPONENTLABELLING_H_ | ||
#define MANTID_CRYSTAL_CONNECTEDCOMPONENTLABELLING_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/IMDHistoWorkspace.h" | ||
#include <boost/shared_ptr.hpp> | ||
|
||
namespace Mantid | ||
{ | ||
namespace Crystal | ||
{ | ||
class BackgroundStrategy; | ||
|
||
/** ConnectedComponentLabelling : Implements connected component labeling on MDHistoWorkspaces. | ||
Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport ConnectedComponentLabelling | ||
{ | ||
public: | ||
ConnectedComponentLabelling(); | ||
void startLabellingId(const size_t& id); | ||
boost::shared_ptr<Mantid::API::IMDHistoWorkspace> execute(Mantid::API::IMDHistoWorkspace_sptr ws, BackgroundStrategy * const strategy) const; | ||
virtual ~ConnectedComponentLabelling(); | ||
private: | ||
size_t m_startId; | ||
|
||
}; | ||
|
||
|
||
} // namespace Crystal | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_CRYSTAL_CONNECTEDCOMPONENTLABELLING_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
Code/Mantid/Framework/Crystal/inc/MantidCrystal/HardThresholdBackground.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#ifndef MANTID_CRYSTAL_HARDTHRESHOLDBACKGROUND_H_ | ||
#define MANTID_CRYSTAL_HARDTHRESHOLDBACKGROUND_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidCrystal/BackgroundStrategy.h" | ||
#include "MantidAPI/IMDWorkspace.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace Crystal | ||
{ | ||
|
||
/** HardThresholdBackground : Implementation of BackgroundStrategy using a fixed background signal value as the threshold. | ||
Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport HardThresholdBackground : public BackgroundStrategy | ||
{ | ||
public: | ||
HardThresholdBackground(const double thresholdSignal, const Mantid::API::MDNormalization normalisation); | ||
virtual bool isBackground(Mantid::API::IMDIterator* iterator) const; | ||
void configureIterator(Mantid::API::IMDIterator* const iterator) const; | ||
virtual ~HardThresholdBackground(); | ||
private: | ||
/// Cutoff | ||
const double m_thresholdSignal; | ||
/// Normalization | ||
const Mantid::API::MDNormalization m_normalization; | ||
}; | ||
|
||
|
||
} // namespace Crystal | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_CRYSTAL_HARDTHRESHOLDBACKGROUND_H_ */ |
Oops, something went wrong.