lsgrmController.h 2.40 KiB
#ifndef __LSGRM_CONTROLLER_H
#define __LSGRM_CONTROLLER_H
#include "lsrmGetInternalMemory.h"
#include "lsgrmSplitter.h"
#include "lsgrmGraphOperations.h"
#include "itkMacro.h"
namespace lsgrm
{	
	template<class TSegmenter>
	class Controller
	public:
		/* Some convenient typedefs */
		using SegmenterType = TSegmenter;
		using ImageType = typename SegmenterType::ImageType;
		using LabelImageType = typename SegmenterType::LabelImageType;
		using SegmentationParameterType = typename SegmenterType::ParameterType;
		/* Default constructor and destructor. */
		Controller();
		~Controller();
		void RunSegmentation();
		void SetImageDivision(bool f);
		void SetInputImage(ImageType * inputImage);
		void SetTemporaryDirectory(const std::string& str);
		void SetTileWidth(const unsigned int v);
		void SetTileHeight(const unsigned int v);
        void SetNumberOfFirstIterations(const unsigned int v);
        void SetNumberOfIterations(const unsigned int v);
		void SetSpecificParameters(const SegmentationParameterType& params);
		void SetThreshold(const float& t);
		void SetInternalMemoryAvailable(long long unsigned int v); // expecting a value in Mbytes.
		void SetAutomaticTilingLayout(bool value);
		typename LabelImageType::Pointer GetLabeledClusteredOutput();
		itkGetMacro(ListOfTemporaryFiles, std::vector<std::string>);
	private:
		void GetAutomaticConfiguration();
		long unsigned int GetMaximumNumberOfNodesInMemory();
		/* Parameters given by the user */
		long long unsigned int m_Memory; // RAM available for the computation.
		ImageType * m_InputImage; // Input image
		std::string m_TemporaryDirectory; // Directory used to store intermediate files during the process.
		bool m_ImageDivisionActivated; // The input image must be divided.
		bool m_CleanTemporaryDirectory; // Clean the temporary directory.
		/* Specific segmentation parameters */
		SegmentationParameterType m_SpecificParameters;
		float m_Threshold;
		/* Internal attribute members.*/
		unsigned int m_NbTilesX;
		unsigned int m_NbTilesY;
        unsigned int m_NumberOfFirstIterations;
        unsigned int m_NumberOfIterations;
		unsigned int m_Margin;
		unsigned int m_TileWidth;
		unsigned int m_TileHeight;
		bool m_AutomaticTilingLayout;
		std::vector<ProcessingTile> m_Tiles;
		std::vector<std::string> m_ListOfTemporaryFiles;
7172737475767778
typename LabelImageType::Pointer m_LabelImage; }; } // end of namespace lsgrm #include "lsgrmController.txx" #endif