Title: Medizinische Bildverarbeitung Altfragen

Q: Difference between ASMs and AAMs? What are the requirements?
A: Both:  Are statistical models of shape/variation and appearance of image structures to match/fit to new images
Model Shape:
Active Appearance Model:
- use shape and texture information to model shape (representing shape/texture variation)
- entire texture is enclosed by landmarks (in difference to ASM) by triangulating the mean shape
Active Shape Model:
-use only shape information to model shape
Training:
Beide: both perform PCA on the shapes with a training set to create mean model/shape and other models
AAM: use regressionmatrix and Cannonical Correlation Analysis(CCA) during the training to enable effience searching
ASM: use gray values along texture at each landmark and shift their profils orthogonal to shape to minimized mahalanobis distance to find best fit
Requirements:
1. Big Dataset:
- big dataset to receive good and exact model
-images have to be congruent/similar (deckungsgleich)
limit: get enough training data -> limit in precision
2. landmarks:
- trainingdata needs already annoted landmarks that are present on all images and define shape and structure of the object
- landmarks are annotated manually by expert -> lot of work
- limit in size of dataset through manual annotation of landmarks
3. Good Initialization:
- set model into good position
- by correct rotation, scaling and translation

Q: Describe in detail the AAM search and draw the AAM Model Training.
A: Initialization - Difference Image - Parameterupdate - Modelupdate
1. Initialization:
- before AAM Search: create shape and texture model from Trainingset with the help of the annoted landmarks
- use PCA to compute eigenvector and eigenvalues to create shape eigenspace and texture eigenspace
- combine them to a combined shape-texture-eigenspace to capture shape and texture variation by a single model
- form regression matrix to relate shape and appearance
- resulting model gets parameterized to enable representation of the new image/object
2. Difference Image:
- create Difference Image (represent error between input image and model estimate)
3. Parameterupdate
- search for best parameters that best fit object to input image (minimize differences)
- update shape and appearance by using regression matrix
- get correction of the parameter by projecting current difference image onto regression matrix
4. Update Model
- update model with help of correctionparameter (rotation,tranlation, scaling)
5. Repeat until search / model converges

Q: Requirements for modelbased search?
A: Requirements:
1. Big Dataset:
- big dataset to receive good and exact model
-images have to be congruent/similar (deckungsgleich)
limit: get enough training data -> limit in precision
2. landmarks:
- trainingdata needs already annoted landmarks that are present on all images and define shape and structure of the object
- landmarks are annotated manually by expert -> lot of work
- limit in size of dataset through manual annotation of landmarks
3. Good Initialization:
- set model into good position
- by correct rotation, scaling and translation

Q: Describe and outline the Active Shape Model search. What texture/property is considered in ASM? How does search work on new image?
A: 1. Initalization:
- create mean model by using normalised trainingdata with annoted landmarks
- for each landmark, generate local texture models(grayvalue profiles) and covariance matrix
- create estimated refence positions as intial positions
2. Adjust Shape to Texture
- shift profil orthogonally to shape
- minimize mahalanobis distance for each landmark to create new landmark position
3. Update Shape Model
- parameters b of model to match new landmark positions
4. Repeat until model converge to new image
Unlike AAM, the entire texture within the landmarks is taken into account.

Q: Describe a method for dimensionality reduction.
A: Prinicipal Component Analysis(PCA):
- method for dimensionality reduction
1. compute mean and subtract from data
2. compute covariance from that
3. using eigenvalue decomposition of covariance to get eigen values and eigen vectors
4. sort eigenvectors by eigenvalue
    - first eigenvector (with highest eigenvalue) points in direction of largest variance
    - eigenvector are orthogonal to each other
   - eigenvalue desribe variance of data in eigenvector direction (principal component)
5. reduce dimensionality by only using leading eigenvectors (coverage of total variance such as 95%)
6. with new input vector, project it into the eigenspace
7. result: coeffience/parameter vector with reducted dimensionality

Q: Given two covariance matrices: A = [4 0 ; 0 1] and B = [3 1 ; 1 2].
a. Sketch the two distributions of sets of points A and B, respectively, in a 2-dimensional space.
b. On which of the two data sets does PCA make sense?
A: if covariance x,y 0 -> x y independet from each other (uncorrelated)
(x oben links, y unten rechts)
A = [4 0 ; 0 1]              B = [3 1 ; 1 2]
b. On which of the two data sets does PCA make sense?
Only for B, since A has two uncorrelated variables and cannot reduced in dimensionality

Q: a. What two terms determine the energy function for explicit snakes?
b. What are the effects of the two terms on the resulting curve?
A: (active contours = snakes)
a.
Smoothness:
- first derivate of contour( Ableitung): elasticity (how much stretch or bending)(curve short/long),
- second derivate of contour: Tightness/curvature/rigidity (curve strong,weak)
Gradient:
- Brightness difference/Intensity value along both side of contour
b.
- snake goes along high gradient areas, and takes a smooth path
- smoothness is weighted only half as much as gradient
explicit/external energy/gradient:
- capture image content by penalizing journeys along low gradient paths
- find local maxima - minimal energy
implicit/internal energy/smoothness:
- penalizing first (elasticity) (points not far apart)  and second (rigidity)(not so strong curvatures) derivate of path
- penalizing sharp bends or deviations from a straight line

Q: You need to segment the black structures in the adjacent image, which Snake formulation do you use? Why?
A: Explicite snakes:
- high contrast between black structures and background - find easy local maxima, high gradient
- limitation: topology and resolution fixed
Implicit snake:
- create zero level set
- rusults in non-resolution and non-topology dependent function
- works well, cause contrast high and deliver accurate results
Explicit snakes:
- A curve is explicitly represented as a set of points
- The curve is iteratively updated to minimize an energy function defined using external and internal forces
- Computationally efficient as it involves only simple point updates
- Prone to leakage (snakes can escape the object boundaries) and can converge to local minima
Implicit snakes:
- The curve is implicitly represented as the zero-level set of a higher-dimensional function
- The curve is evolved using partial differential equations (PDEs) to minimize an energy functional
- More computationally expensive than explicit snakes due to solving PDEs
- Less prone to leakage and can converge to global minima
- Can handle topological changes, such as splitting or merging of objects

Q: You are performing image segmentation using a Markov Random Field,
i.e. you want to partition the image into two areas (bones vs. background).
How are pixels represented in the MRF?
How areneighborhood relations represented?
How do you represent the affiliation(zugehörigkeit) of the two areas in the MRF?
A: Markov Random Field:
- describe image/problem with graphs
- use nodes with different possible labels
Pixel representation:
-Each node (= landmarks) has a set of possible pixel labels (= possible position in the search image). (in this case two, bones or background)
- label represent state of markov random field
Neighbor relations:
- For each pixel, the neighboring pixels are defined as neighbors.
- neighbor relation between pixel as edges connecting the nodes
affiliation to both areas:
- Each model-landmark(node) is assigned a position in the image.
- Segmentation is done using Graph Cuts

Q: Outline a method for detecting an abnormality (e.g., lesion) using a classifier?
A: Random Forest:
-detecting by using random forests classifier
-train/create many decision trees from labeled training data
1. Each decision in each decision tree is trained on a random
sub-set of the training examples, and a random sub-set of
the available features
2. for each split the optimal feature(Eigenschaft) is chosen
2. Application to new data: voting of all decision trees and apply the optimal feature (where the majority of trees vote for/have same feature)
3. very accurate and stable with reference to noise and useless features

Q: Your task is to design a software for automatic segmentation of femurs in X-ray images. You have 400 sample datasets available, but only 1h of a medical doctor.
What method can you perform to produce a stable
segmentation algorithm (i.e. an algorithm, which also works with noisy data, and
and possibly only partially visible contours)? Describe roughly the procedure
A: - only 1 hour, but large dataset
- automatically annotate data und built active shape model
1. (single modality (only x-ray images)) registration of training images (scale,translate,rotate,transformation if not normalized)
2. find interest points in images (using classifier): position + image information(e.g gradient)
3. Find initial correspondence between images (pairwise matching and robust homography)
4. optimize correspondence/landmark position with genetic algorithm or direct fine search
     - genetic: randomly change of assigned landmarks - new solutions rated (if better than mutated)
5. group landmarks based on MDL criterium (e.g simulated annealing)
6. on all 400 samples, select femurs and discard other landmarks (work is done fast, because always same femur)
7. create active shape model with annotated data
8. find femur in new images with ASM search

Q: In what ways are Graph Cuts different from snakes, and what do they have in common? Optimization?
A: Both: non-model based segmentation methods
snake:
- use curves which are a set of discrete points
- find lowest energy function for curves by using criterion (gradient and smoothness) (minimize criterion)
- e.g find high gradient along curve and smooth paths
graph cuts:
- image represented as graph with nodes (pixels) and edges (similarity of neighbor pixels)
- graph cut by finding path with lowest cost to create two regions

Q: What is a requirement for the use of Active Shape Models (as opposed to Active Contours/Snakes)?
A: ASMs are landmark based, and require previously annotated corresponding landmarks. Furthermore, ASMs are model-based, so they require a training set to determine the shape of the model.
ASMs:
landmark based
- need annotated corresponding landmarks
- also model based, need training set to determine shape of the model
Active Contours:
- non-model based, only needs texture

Q: Which material property is measured with CT, in which unit?
A: CT: 3D reconstruction of X-rays
- measure attenuation of the tissue, which is related to their density
- unit: Houndsfield unit (air: -1000, water 0)

Q: What registration method to use if you need to examine fMRI and MRI images from 30 brains of different individuals.
 I.e. you want to compare the fMRI signals at corresponding positions in different persons (specify transformation and reasonable similarity measures)
How do you proceed?
Can you use a Talairach template for this task?
A: - 30 different brains, direct regististration difficult due to higher variability
first we use MRI images:
1. all mri data mapped to an atlas (Talairach atlas)
Talairach atlas: Reference Framework to compare (used for process with differen subjects)
2. voxel-similarity based singal modality registration (to compare source and target)
- Similarity measures assume functional relationship between intensities
(Registration based on geometric features is independent from modality
Registration based on voxel-similarity measures must account for difference between
• Single-modality (CT-CT, MRI-MRI, PET-PET,...)
• Multi-modality (CT-PET, MR-PET, CT-MR,...)
3. for single modality similarity function
-  SAD (sum of absolute differences)
- or Normalized cross correlation (CC)
4. use transformation function (non-rigid transformation, because each mri map to atlas)
- rigid transformation: shape remains constant
- affine, when shape can change, but structure is presevered
- use transformation function: Thin plate spline transformation -> mapping each MRI data to Atlas
If we now registers the fMRI data to the individual MRI data, we can then map them to the atlas using the previously obtained transformation  to the atlas and make them comparable.
1. fmri data registration through voxel-similarity multi-modal registration
2. for multi-modal similiarity
- normalized mutual information ->indepentend from the amount of overlap of the two images.
3. use transformation function
- affine transformation (because same brain structure)
4. map registered fmri data onto mri atlas registered data

Q: Which of the two modalities has a higher temporal resolution: EEG or fMRI?
A: - EEG has a higher temporal resolution than fMRI.
- EEG can measure neural activity in real-time with millisecond-level resolution
- fMRI has a temporal resolution on the order of seconds.

Q: Which of the two modalities has higher spatial resolution: MEG or fMRI? What is measured with MEG?
A: fMRI has higher spatial resolution
fMRI: detects oxygen consumption and changes in blood flow (indirect neuronal activity)
MEG: measures the external magnetic field by electrical activity in the brain

Q: Which imaging modality can be used to observe nerve fibre bundles?
A: Diffusion Tensor Imaging with MRI
- measure diffusion of water molecule in tissues
- spread of water is greatest between the vessel and nerves
- use/compute diffusion tensor (3x3 matrices) - get 3d diffusion behaviour ->  detect directions of fiber

Q: What is the difference between implicit and explicit Active Contours?
A: explicit:
- set of discrete points connected thorugh path
- can be parametrized , but fixed topology
implicit:
- find countour through help function, e.g level sets
- no discrete points, curves, parametrization or fixed topology

Q: Starting from a correct registration of two data sets, a data set is shifted i.e. an artificial error is generated. How does this affect the measure or the underlying joint probability
distribution of the voxel values? (Answer also possible with sketch)
A: - if error - also bad similarity measure - loss of information, because mismatch in voxel position
- joint probability it will also get worse -> larger displacement
Joint probability: describe the probability that a pixel having intensity a in one
image and intensity b in the other image

Q: Name a similarity measure for volume record registration, the use of which is useful for registering different modalities.
A: Multimodale Similaritätsmaße are:
Joint entropy:
- describe amount of information that is in both images
- based on the joint-probability
- lot of commonanilty: entropy decrease
- unrelated: entropy increase
Mutual Information und normalized Mutal Information:
- how well one image is explained by another
- expressed by probability distributions
- independet from amount of overlap of images
- better if images show just a part of anatomic structure

Q: You need to register a CT data set with an MRI data set. Both data sets show the brain of the same person. Which similarity measure do you apply? Which optimization is suitable? Which deformation type is applicable? Justify your choice.
A: two different modalities:
Similirity measure:
normalized mutual information -> describe how well one image is explained by other image
- used probability distributions
- optimization by maximizing mutual information, by maximizing the information that one image carries about the other one
- combine with multi resolution strategy to avoid problem with capture range and local maxima
transformation:
affine transformation, meaning translation, rotation, scaling, shear , because shape of brain same

Q: Which (a) image similariate measure, and which (b) type of transformation is necessary for the image registration of PET and CT image volumes of the brain of the same patient? Please explain why. also optimization
A: similarity measure:
- using voxel-similarity multi modal:
e.g joint entropy:
- describe amount of information in the combined images A and B
- if a and B related, entropy small,
- if a and b unrelated, entropy bigger
transformation:
affine transformation (translation, rotation, scaling, shear , because shape of brain same)
optimization:
- optimization by using multi resolution strategy to avoid problem with capture range and local maxima

Q: What methods can relate the BOLD signal in fMRI data to cognitive processes?
e.g: Given an fMRI sequence, and the time intervals in the sequence during which a hand is
is moved. How do you localize the activated region in the brain?
A: two methods can be used: (both have to create a designmatrix before)
Univariat (abhängig von einer Variable) General Linear Model:
-each voxel compare with stimuli (and therefore the design matrix)
- if high depenedncy from design matrix, could be a connection with hand movement(cognitive process)
- voxel with high dependency - activated areas in brain
multivariat(abhängig von mehreren) Multi Voxel Pattern Analysis:
- problem with GLM: if voxel has no dependency but synchronize with other voxel during stimuli
- compare multiple voxels with each other and correlation
- use classifier (random forest) to find activity
- baseline and task as label
- voxel as features

Q: Explain the difference between a General Linear Model (GLM) und Multi Voxel Pattern Analysis (MVPA) for the study of brain function and neuro imaging.
b.) Which analysis method and which imaging modality do you have to use to detect brain areas that are active if a person moves a toe? What happens while the person is in the scanner?
A: GLM:
each voxel gets compare with stimuli (and therefore the design matrix)
MVPA:
compare multiple voxels with each other and correlation during the stimulus
imaging modality:
fMRI - measure blood flow and oxygenlevel which shows activity in brain
- if the person move toe, activity can be seen
Analysis method:
GLM can analyse the fmri data, where wo compare each voxel with the stimulus
- if significant increase in blood flow happens (compared to baseline periods (no task)), then able to idendity the active areas

Q: What does fMRI measure, and what does it provide information about?
A: fMRI (functional magnetic resonance imaging) measures the changes in blood oxygenation levels in the brain that occur in response to neural activity
fMRI thus provides information about metabolic processes (since they require oxygen) and can thus be associated, for example, with
active brain regions.

Q: Functional brain studies are affected by the variability of the study population. What can be done to nevertheless arrive at a conclusion about, for example, the connection between a Certain activity, and the activation in the brain?
A: - finding connection between certain activity and activation with variability of study population
- use new geometry
- find relationship between data
- with Markov Chain, find pair-wise affinity between points in brain and compute diffusion distance
- with eigenvalue decomposition, map diffusion distance to euclidean distance
- generate a new map, which can compare mulitple populations

Q: How can you validate segmentation methods?
Provide the measures necessary to meaningfully compare different methods. What is accuracy and what is precision?
A: Accuracy:
- ability of the method to mirror standard of reference measurements or diagnosis
Precision:
- ability to provide repeatable measurements, eg low variability due to noise
increases the smallest unit that
can be measured reliably
Specificity:
ratio of negative cases correctly classified as negative
Sensitivity:
ratio of true cases correctly classified as true

Q: What measures to use to validate classification?
A: Smallest detectable difference (SDD) or resolution:
smallest difference that can be detected (and not a measurement error)
coefficient of variation:
- amount of measurement variation compared to mean measurement

Q: How can you validate a measurement method if they don't have ground truth available?
A: normally use standard of reference
We trust this standard of reference only to a certain degree
(e.g., proved to be precise in preceding studies)
if we don’t have a s.o.r. we can use the knowledge about the disease
• Example: two treatment groups, we know that there is a
difference (from more reliable indicators) and observe:
how significant is the difference between the groups, that
our measurement reports. (be very careful!)

Q: How can we validate a segmentation method? Give the measures necessary to meaningfully compare different methods. What is accuracy and what is precision?
A: Cross-validation:
- dataset split into multiple subset
- segmentation method is trained and tested on different subsets
- evaluate the performance of algorithm
- Needs a third test-set since usually the parameters of the
algorithm are altered during cross-validation, Thus the
validation sets have already influenced the choices
algorithm parameters

Q: How can you evaluate methods that identify a specific disease based on patient data (i.e. a classifier of patients). List two evaluation measures necessary to asses and compare methods. Briefly describe their relationship.
A: Validation to evaluation measures like:
Specificity:
Ratio of negative cases correctly classified as negative
(patients without the disease who were correctly identified by the classifier)
Sensitivity:
Ratio of true cases correctly classified as true
(patients with the disease who were correctly identified by the classifier)
These measures are complementary and inversely related: as sensitivity increases, specificity tends to decrease and vice versa. A good classifier should have a balance of both measures, with high sensitivity and specificity.

Q: Which material properties does CT measure? Which transformation is necessary to reconstruct 3D imaging data from the measured signals?
A: CT (computed tomography) measures X-ray attenuation of tissues, which is dependent on their density and atomic number. X-rays are passed through the body and detected on the other side of the object. The detected signal is then processed using mathematical algorithms to reconstruct a 3D image of the object's internal structures.
The necessary transformation to reconstruct 3D imaging data from the measured signals in CT is the Radon transform.
The Radon transform calculates the integral of the attenuation coefficients along a line through an object. The projection data obtained from different angles are then used to create a 2D or 3D image of the object using a reconstruction algorithm

Q: How can you identify groups of similar examples in the data set with help of an Auto Encoder?
A: unsupervised learning technique
The autoencoder
Force the network to represent the data in a smaller dimensional vector and reconstruct the image from this lower dimensional vector; Then the idea is to create a segmentation label map
- easier to identify groups of similar examples

Q: How can you train a decision tree in a random forest? Please sketch the process.
How are the training examples selected that are used to train an individual decision tree?
How are the final classification results composed?
A: 1. Selecting a random subset of training examples from the entire dataset, called a bootstrap sample.
2. Randomly selecting a subset of features to use for splitting at each node.
3. Building a decision tree on the bootstrap sample using the selected features.
4. Repeating steps 1-3 to create multiple decision trees.
5. Combining the predictions of all decision trees to make a final prediction.
The training examples used for each individual decision tree are selected using a technique called bootstrapping. Bootstrapping involves randomly sampling the original dataset with replacement to create a new dataset of the same size. This creates a dataset with some duplicates and some missing data points, which introduces variability into the training process.
The final classification result in a random forest is determined by aggregating the predictions of all the individual decision trees. Each tree votes on the classification of the input data, and the most common prediction is chosen as the final result. This technique is called ensemble learning and is used to improve the accuracy and robustness of the overall classification prformance.

Q: Which type of visual information of the training examples does an Active Shape Model (ASM) use?
b.) Explain how a low-dimensional representation of the shape variability is created during the ASM training
A: a) An Active Shape Model (ASM) uses the visual information of the shape of the objects in the training examples. Specifically, it captures the variations in the shape of the objects, such as differences in
- shape
- texture
- orientation
- scale
- position
b) During the ASM training, a low-dimensional representation of the shape variability is created using principal component analysis (PCA).
- method for dimensionality reduction
1. compute mean and subtract from data
2. compute covariance from that
3. using eigenvalue decomposition of covariance to get eigen values and eigen vectors
4. sort eigenvectors by eigenvalue
    - first eigenvector (with highest eigenvalue) points in direction of largest variance
    - eigenvector are orthogonal to each other
   - eigenvalue desribe variance of data in eigenvector direction (principal component)
5. reduce dimensionality by only using leading eigenvectors (coverage of total variance such as 95%)
6. with new input vector, project it into the eigenspace
7. result: coeffience/parameter vector with reducted dimensionality

Q: What is imaged with Magnetic Resonance Imaging (MRI)? Explain the basic principle of MRI.
A: Is based on magnetic resonance, relevant for soft tissue: tumor detection, …
use Nuclear magnetic resonance
Idea: every proton has a magnetic moment, is chaotic and a way to organize is to put a magnetic field to it (Aligns the spins of the atoms), The higher the Tesla value => the higher the resolution
Radio frequency impulse hits the spins out of their default direction,
 The atoms slowly move back and emit energy when they move back to their original energy state, 2 times (T1 – spin lattice relaxation long T2 – spin spin relaxation transverse) that tell about the properties of the tissue

Q: a.) Describe to properties of imaging data that is exploited by U-Nets to segment images.
b.) Which input/output pairs of data are used for the training of U-Net for the segmentation of cells in microscopy imaging data?
A: U-nets: deep learning for medical image segmentation
- Mapping from images to segmentation labels
translate an observation into a description or e.g., label image
• U-nets are one approach to do this
• Instead of a single output node, they
map images to images
• On the encoder side, U-Nets contain blocks of convolutional
layers and down sampling layers
(max-pooling layers)
• On the decoder site, they contain convolution, and upconvolution layers.
• Layers are additionally
connected by skip-connections

Q: a.) Random Forests (RF) are classifiers, which use multiple variables to predict/classify a label. Explain how RFs can be used to score the relevance of individual features for the correct classification.
 b.) What is the difference between a method to test the correlation of a single feature and the target variable (e.g., class) and the score you can derive from RF training?
A: a) Random Forests (RF) can be used to score the relevance of individual features for correct classification by computing the importance of each feature. The importance of a feature is determined by calculating the decrease in impurity when the feature is used for splitting the data at a particular node in the decision tree. This process is repeated for all the trees in the forest, and the importance scores are averaged over all the trees. The features with higher importance scores are considered more relevant for classification.
b)
A method to test the correlation of a single feature and the target variable typically involves computing a correlation coefficient or another statistical measure that quantifies the strength of the relationship between the feature and the target. This approach provides information about the importance of a single feature but does not consider how the feature interacts with other features in the dataset.
In contrast, the score derived from RF training, such as the Gini importance score, considers the interactions between features and their ability to reduce the impurity of decision trees. RF builds multiple decision trees using random subsets of features and training samples, and the Gini importance score reflects how much each feature contributes to the reduction of impurity across all trees. This approach provides a more comprehensive measure of feature importance that takes into account interactions between features, and can help identify features that are not strongly correlated with the target variable individually but play an important role in classification when combined with other features.

Q: You are using an ROC curve to evaluate a classifier that detects malignant lesions in imaging data. The primary priority is to avoid false negatives in your detection. Which part of the ROC is relevant? Explain why.
A: In an ROC (Receiver Operating Characteristic) curve, the true positive rate (TPR) is plotted against the false positive rate (FPR) for different classification thresholds. The TPR is the proportion of actual positive samples that are correctly identified as positive by the classifier, while the FPR is the proportion of actual negative samples that are incorrectly identified as positive.
When the primary priority is to avoid false negatives, it means that the cost of missing a true positive is higher than the cost of a false positive. In other words, it is more important to correctly identify all the malignant lesions, even if it means classifying some benign lesions as malignant (false positives).
In this scenario, the relevant part of the ROC curve is the region where the FPR is low (i.e., a high specificity) while the TPR is high (i.e., a high sensitivity). This means that the classifier is correctly identifying most of the malignant lesions (high TPR) while keeping the number of false positives to a minimum (low FPR).

Q: Explain how an algorithm for the detection of lesions in a liver with help of a classifier can be designed. Describe both training set, training, and the application of the algorithm to new data.
A: 1. Data Collection: Collect a dataset of liver images with and without lesions from different sources.
2. Data Preprocessing: Preprocess the data to remove noise, artifacts, and to normalize the data.
3. Feature Extraction: Extract relevant features from the liver images, which will be used to train the classifier. Common features used for lesion detection are size, shape, texture, and intensity of the lesion and its surrounding tissue.
4. Data Labeling: Manually label each image in the dataset to indicate whether it contains a lesion or not.
5. Training Set Creation: Split the dataset into two sets: training set and validation set. Use the training set to train the classifier and the validation set to evaluate the performance of the classifier.
6. Training the Classifier: Train the classifier(e.g random forest) using the training set and the extracted features.
7. Performance Evaluation: Evaluate the performance of the classifier using the validation set. Common evaluation metrics for lesion detection are accuracy, sensitivity, specificity, F1-score, and the Area Under the ROC curve (AUC-ROC).
8. Application: Apply the trained classifier to new liver images to detect lesions. The classifier will analyze the extracted features of the image and predict whether it contains a lesion or not.

Q: Which method can you use to detect anomalies in images, even if during training you did not have access to any positive training examples (i.e., examples that have the anomaly)?
A: One method that can be used to detect anomalies in images without positive training examples is by utilizing Generative Adversarial Networks (GANs). GANs consist of two neural networks: a generator and a discriminator.
During training, the generator network learns to generate synthetic images that resemble the normal patterns present in the training data. The discriminator network, on the other hand, is trained to distinguish between real images from the training data and the synthetic images generated by the generator.
Once the GAN is trained, the generator network can be used to generate new images that are similar to the training data. To detect anomalies, these generated images are compared to the input images. If the generated image significantly deviates from the input image, it is likely to be an anomaly.
By training the GAN on a large dataset of normal images, the generator learns to capture the normal patterns and structures. During the anomaly detection phase, if the generated image fails to capture these patterns, it indicates the presence of an anomaly.
The advantage of using GANs for anomaly detection is that they do not require explicit labeling of anomalous data during training. The GAN learns to capture the underlying normal distribution implicitly and can identify anomalies based on deviations from this distribution.