20#include "vtkInfovisCoreModule.h"
219 using PairType = std::tuple<std::string, std::string>;
232#define SetStdContainerMacro(name, container) \
233 virtual void Set##name(container arg) \
235 bool changed = false; \
236 if (arg.size() != name.size()) \
242 auto a = arg.begin(); \
243 for (auto r : name) \
266 if (arg != BackgroundColorName)
269 BackgroundColorName = arg;
300 if (ColorSchemeName != arg)
303 ColorSchemeName = arg;
316 vtkSetMacro(DPI,
int);
317 vtkGetMacro(DPI,
int);
344 if (FontFileName != arg)
358 vtkSetMacro(Gap,
int);
359 vtkGetMacro(Gap,
int);
370 if (MaskColorName != arg)
391 if (MaskFileName != arg)
404 vtkSetMacro(MaxFontSize,
int);
405 vtkGetMacro(MaxFontSize,
int);
412 vtkSetMacro(MinFontSize,
int);
413 vtkGetMacro(MinFontSize,
int);
422 vtkSetMacro(MinFrequency,
int);
423 vtkGetMacro(MinFrequency,
int);
431 vtkSetMacro(FontMultiplier,
int);
432 vtkGetMacro(FontMultiplier,
int);
463 return OrientationDistribution;
476 Orientations.push_back(arg);
491 ReplacementPairs.push_back(arg);
515 StopWords.insert(word);
533 if (StopListFileName != arg)
536 StopListFileName = arg;
566 if (WordColorName != arg)
640 typedef std::function<bool(std::pair<std::string, int>, std::pair<std::string, int>)> Comparator;
642 std::multiset<std::pair<std::string, int>, Comparator> FindWordsSortedByFrequency(
646 ExtentOffset(
int _x = 0.0,
int _y = 0.0)
Generic algorithm superclass for image algs.
a simple class to control print indentation
virtual void Modified()
Update the modification time for this object.
generate a word cloud visualization of a text document
virtual OrientationsContainer GetOrientations()
virtual OffsetDistributionContainer GetOffsetDistribution()
virtual void SetFontFileName(VTK_FILEPATH std::string arg)
Set/Get FontFileName, If empty, the built-in Arial font is used().
virtual void SetWordColorName(std::string arg)
Set/Get WordColorName, the name of the color for the words().
virtual void SetBackgroundColorName(std::string arg)
Set/Get the vtkNamedColors name for the background(MidNightBlue).
virtual SizesContainer GetAdjustedSizes()
Return the AdjustedSizes of the resized mask file.
static vtkWordCloud * New()
Construct object with vertex cell generation turned off.
virtual void SetFileName(VTK_FILEPATH std::string arg)
Set/Get FileName, the name of the file that contains the text to be processed.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called in response to a REQUEST_DATA request from the executive.
std::vector< PairType > ReplacementPairsContainer
virtual void SetTitle(std::string arg)
Set/Get Title, add this word to the document's words and set a high frequency, so that is will be ren...
std::string StopListFileName
vtkSmartPointer< vtkImageData > ImageData
std::array< int, 2 > OffsetDistributionContainer
std::string ColorSchemeName
SetStdContainerMacro(Orientations, OrientationsContainer)
Set/Add/Get Orientations, a vector of discrete orientations ().
virtual std::vector< std::string > & GetKeptWords()
Get a vector of words that are kept in the final image.
virtual void SetColorSchemeName(std::string arg)
Set/Get ColorSchemeName, the name of a color scheme from vtkColorScheme to be used to select colors f...
virtual std::string GetWordColorName()
virtual void SetMaskColorName(std::string arg)
Set/Get MaskColorName, the name of the color for the mask (black).
std::tuple< std::string, std::string > PairType
SetStdContainerMacro(StopWords, StopWordsContainer)
Set/Add/Get StopWords, a set of user provided stop words().
std::string WordColorName
virtual std::string GetMaskFileName()
std::string BackgroundColorName
SetStdContainerMacro(ColorDistribution, ColorDistributionContainer)
Set/Get ColorDistribution, the distribution of random colors(.6 1.0), if WordColorName is empty.
std::array< double, 2 > ColorDistributionContainer
virtual std::vector< std::string > & GetStoppedWords()
Get a vector of words that were stopped in the final image.
std::set< std::string > StopWordsContainer
ReplacementPairsContainer ReplacementPairs
std::array< double, 2 > OrientationDistributionContainer
std::vector< std::string > StringContainer
SizesContainer AdjustedSizes
virtual std::vector< std::string > & GetSkippedWords()
Get a vector of words that are skipped.
SetStdContainerMacro(Sizes, SizesContainer)
Set/Get Sizes, the size of the output image(640 480).
OrientationsContainer Orientations
virtual std::string GetTitle()
virtual SizesContainer GetSizes()
OrientationDistributionContainer OrientationDistribution
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
virtual std::string GetFontFileName()
virtual void SetMaskFileName(VTK_FILEPATH std::string arg)
Set/Get MaskFileName, the mask file name().
virtual std::string GetStopListFileName()
virtual void SetStopListFileName(VTK_FILEPATH std::string arg)
Set/Get StopListFileName, the name of the file that contains the stop words, one per line.
virtual StopWordsContainer GetStopWords()
virtual std::string GetFileName()
SetStdContainerMacro(OffsetDistribution, OffsetDistributionContainer)
Set/Get OffsetDistribution, the range of uniform random offsets(-size[0]/100.0 -size{1]/100....
virtual std::string GetMaskColorName()
std::vector< std::string > SkippedWords
std::vector< std::string > KeptWords
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
ColorDistributionContainer ColorDistribution
SetStdContainerMacro(OrientationDistribution, OrientationDistributionContainer)
Set/Get OrientationDistribution, ranges of random orientations(-20 20).
virtual ColorDistributionContainer GetColorDistribution()
virtual std::string GetBackgroundColorName()
virtual ReplacementPairsContainer GetReplacementPairs()
virtual std::string GetColorSchemeName()
StopWordsContainer StopWords
~vtkWordCloud() override=default
virtual OrientationDistributionContainer GetOrientationDistribution()
std::vector< double > OrientationsContainer
void AddReplacementPair(PairType arg)
std::vector< std::string > StoppedWords
void AddStopWord(std::string word)
OffsetDistributionContainer OffsetDistribution
virtual void SetBWMask(bool arg)
Set/Get boolean that indicates the mask image is a single channel(false).
SetStdContainerMacro(ReplacementPairs, ReplacementPairsContainer)
Set/Add/Get ReplacementPairs, a vector of words that replace the first word with another second word ...
std::string MaskColorName
std::array< int, 2 > SizesContainer
void AddOrientation(double arg)