## 4 Design of the Platform
### Design of the Diagnosis Manager  
There is a high level of commonality in diagnosing various diseases using CECT scans. Modeling this common diagnosis process can lead to a more effective and reusable design of the platform. However, there are also variabilities in some steps of the main process. Both the common and variable features of the diagnosis process should be captured in the design.  
We design the diagnosis process by applying the Template Method Pattern, which represents a single fixed algorithm as the template method and the variability of some steps in the overall algorithm using subclasses and dynamic binding. The design of the Diagnosis Manager by applying this design pattern is shown in Figure 7.  
The class diagram illustrates the application of the Template Method Pattern in the design of the _Diagnosis Manager_ component. This pattern is characterized by a superclass that defines the skeleton of an algorithm in a template method, consisting of a sequence of method invocations. Some of these method invocations are to abstract methods, referred to as placeholder methods. These placeholder methods, which are designed to be overridden by subclasses, are highlighted in blue in the figure. They represent the customizable parts of the algorithm, allowing for variation in behavior without altering the overall structure or flow of the algorithm.  
The figure illustrates three subclasses that implement the abstract methods defined in the superclass. Each subclass adapts these methods to its specific requirements. For  
Figure 7: Applying the Template Method Pattern for customizability.  
instance, the subclass _Liver_Cancer_Diagnosis_Manager_ implements the _segment_organ()_ method to segment the liver from a given CECT scan. Additionally, it implements the _classify_disease()_ method to classify the type of liver cancer, such as _hepatocellular carcinoma (HCC)_, by applying a standard called _Liver Imaging Reporting and Data System (LI-RADS)_. This classification is based on the analysis of identified tumors, changes over contrast phases, and medical imaging data. The _classify_stage()_ method of this subclass will determine a HCC stage using the categories of LR-NC (Not Categorizable), LR-1, LR-2, LR-3, LR-4, LR-5, LR-5V, LR-M, and LR-TR.  
Similarly, another subclass _LI-Cancer_Diagnosis_Manager_ implements all the abstract methods to its specific requirements for diagnosing _lung cancer_. The implementation of the abstract methods in this subclass can be performed by applying a standard, _Lung Imaging Reporting and Data System (LUING-RAD)_. The _classify_stage()_ method of this subclass will determine a lung cancer stage using the taxonomic categories of Category 0 (Incomplete), Category 1 (Negative), Category 2 (Benign Appearance or Behavior), Category 3 (Probably Benign), Category 4A (Suspicious), Category 4B (More Suspicious), and Category 4X (Highest Concer for Malignancy).  
This design facilitates the reuse of common diagnostic procedures while allowing for customization to accommodate disease-specific diagnostic methods. The design of _Diagnosis Manager_ demonstrates the high reusability of commonality and customizability for variability, which are essential features of any software platform. This design also provides high extensibility through a specialization of the superclass for new types of disease diagnosis using CECT.