Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerTerminologiesModuleLogic.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
6  Queen's University, Kingston, ON, Canada. All Rights Reserved.
7 
8  See COPYRIGHT.txt
9  or http://www.slicer.org/copyright/copyright.txt for details.
10 
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  See the License for the specific language governing permissions and
15  limitations under the License.
16 
17  This file was originally developed by Csaba Pinter, PerkLab, Queen's University
18  and was supported through the Applied Cancer Research Unit program of Cancer Care
19  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
20 
21 ==============================================================================*/
22 
23 #ifndef __vtkSlicerTerminologiesModuleLogic_h
24 #define __vtkSlicerTerminologiesModuleLogic_h
25 
26 // Slicer includes
27 #include "vtkSlicerModuleLogic.h"
28 
29 #include "vtkSlicerTerminologiesModuleLogicExport.h"
30 
31 #include <vtkVector.h>
32 
33 class vtkStringArray;
37 
39 class VTK_SLICER_TERMINOLOGIES_LOGIC_EXPORT vtkSlicerTerminologiesModuleLogic :
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
46 
49  {
50  public:
52  : CodingSchemeDesignator("")
53  , CodeValue("")
54  , CodeMeaning("")
55  { };
56  CodeIdentifier(std::string codingSchemeDesignator, std::string codeValue, std::string codeMeaning)
57  : CodingSchemeDesignator(codingSchemeDesignator)
58  , CodeValue(codeValue)
59  , CodeMeaning(codeMeaning)
60  { };
61  std::string CodingSchemeDesignator;
62  std::string CodeValue;
63  std::string CodeMeaning; // Human readable name (not required for ID)
64  };
65 
67  static const char* GetNameAutoGeneratedAttributeName() { return "Terminologies.AutoUpdateNodeName"; };
69  static const char* GetColorAutoGeneratedAttributeName() { return "Terminologies.AutoUpdateNodeColor"; };
70 
76  bool LoadContextFromFile(std::string filePath);
80  std::string LoadTerminologyFromFile(std::string filePath);
84  std::string LoadAnatomicContextFromFile(std::string filePath);
89  bool LoadTerminologyFromSegmentDescriptorFile(std::string contextName, std::string filePath);
92  bool LoadAnatomicContextFromSegmentDescriptorFile(std::string contextName, std::string filePath);
93 
95  void GetLoadedTerminologyNames(std::vector<std::string> &terminologyNames);
97  void GetLoadedTerminologyNames(vtkStringArray* terminologyNames);
99  void GetLoadedAnatomicContextNames(std::vector<std::string> &anatomicContextNames);
101  void GetLoadedAnatomicContextNames(vtkStringArray* anatomicContextNames);
102 
108  bool GetCategoriesInTerminology(std::string terminologyName, std::vector<CodeIdentifier>& categories);
113  bool FindCategoriesInTerminology(std::string terminologyName, std::vector<CodeIdentifier>& categories, std::string search);
117  bool GetCategoryInTerminology(std::string terminologyName, CodeIdentifier categoryId, vtkSlicerTerminologyCategory* categoryObject);
118 
124  bool GetTypesInTerminologyCategory(std::string terminologyName, CodeIdentifier categoryId, std::vector<CodeIdentifier>& types);
129  bool FindTypesInTerminologyCategory(std::string terminologyName, CodeIdentifier categoryId, std::vector<CodeIdentifier>& types, std::string search);
133  bool GetTypeInTerminologyCategory(std::string terminologyName, CodeIdentifier categoryId, CodeIdentifier typeId, vtkSlicerTerminologyType* typeObject);
134 
139  bool GetTypeModifiersInTerminologyType(std::string terminologyName, CodeIdentifier categoryId, CodeIdentifier typeId, std::vector<CodeIdentifier>& typeModifiers);
143  bool GetTypeModifierInTerminologyType(std::string terminologyName,
144  CodeIdentifier categoryId, CodeIdentifier typeId, CodeIdentifier modifierId, vtkSlicerTerminologyType* typeModifier);
145 
151  bool GetRegionsInAnatomicContext(std::string anatomicContextName, std::vector<CodeIdentifier>& regions);
155  bool FindRegionsInAnatomicContext(std::string anatomicContextName, std::vector<CodeIdentifier>& regions, std::string search);
159  bool GetRegionInAnatomicContext(std::string anatomicContextName, CodeIdentifier regionId, vtkSlicerTerminologyType* regionObject);
160 
165  bool GetRegionModifiersInAnatomicRegion(std::string anatomicContextName, CodeIdentifier regionId, std::vector<CodeIdentifier>& regionModifiers);
169  bool GetRegionModifierInAnatomicRegion(std::string anatomicContextName,
170  CodeIdentifier regionId, CodeIdentifier modifierId, vtkSlicerTerminologyType* regionModifier);
171 
177  bool FindTypeInTerminologyBy3dSlicerLabel(std::string terminologyName, std::string slicerLabel, vtkSlicerTerminologyEntry* entry);
178 
180  static CodeIdentifier CodeIdentifierFromTerminologyCategory(vtkSlicerTerminologyCategory* category);
182  static CodeIdentifier CodeIdentifierFromTerminologyType(vtkSlicerTerminologyType* type);
183 
187  static std::string SerializeTerminologyEntry(vtkSlicerTerminologyEntry* entry);
188 
192  static std::string SerializeTerminologyEntry(
193  std::string terminologyContextName,
194  std::string categoryValue, std::string categorySchemeDesignator, std::string categoryMeaning,
195  std::string typeValue, std::string typeSchemeDesignator, std::string typeMeaning,
196  std::string modifierValue, std::string modifierSchemeDesignator, std::string modifierMeaning,
197  std::string anatomicContextName,
198  std::string regionValue, std::string regionSchemeDesignator, std::string regionMeaning,
199  std::string regionModifierValue, std::string regionModifierSchemeDesignator, std::string regionModifierMeaning );
200 
205  bool DeserializeTerminologyEntry(std::string serializedEntry, vtkSlicerTerminologyEntry* entry);
206 
208  static std::string GetInfoStringFromTerminologyEntry(vtkSlicerTerminologyEntry* entry);
209 
210 public:
211  vtkGetStringMacro(UserContextsPath);
212  vtkSetStringMacro(UserContextsPath);
213 
214 protected:
217 
218  virtual void SetMRMLSceneInternal(vtkMRMLScene* newScene) VTK_OVERRIDE;
219 
221  void LoadDefaultTerminologies();
223  void LoadDefaultAnatomicContexts();
225  void LoadUserContexts();
226 
227 protected:
230 
231 private:
233  void operator=(const vtkSlicerTerminologiesModuleLogic&); // Not implemented
234 
235  class vtkInternal;
236  vtkInternal* Internal;
237  friend class vtkInternal;
238 };
239 
240 #endif
static vtkSlicerModuleLogic * New()
The Usual vtk class functions.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
static const char * GetColorAutoGeneratedAttributeName()
Node attribute name for color auto generated.
Information needed to uniquely identify a terminology code.
Terminology property type object.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
static const char * GetNameAutoGeneratedAttributeName()
Node attribute name for name auto generated.
char * UserContextsPath
The path from which the json files are automatically loaded on startup.
CodeIdentifier(std::string codingSchemeDesignator, std::string codeValue, std::string codeMeaning)
Terminology property category object.