ITK Statistical Classification Kitware Inc.. Statistical Classification Multiple Components Images K-Means Markov Random Fields.

Slides:



Advertisements
Similar presentations
Lecture 3 Some commonly used C programming tricks. The system command Project No. 1: A warm-up project.
Advertisements

Doxygen. Links
ITK Architecture Kitware Inc.. ITK Basics C++ Generic Programming Data Pipeline Multi-threading Streaming Exceptions Events / Observers Tcl, Python and.
Getting Started with ITK + VTK
ITK Segmentation Methods
ITK Registration Methods
ITK-Overview Insight Software Consortium. What is ITK Image Processing Segmentation Registration No Graphical User Interface (GUI) No Visualization.
ITK Deformable Registration
National Alliance for Medical Image Computing Slicer3 plugins: Going Further Common architecture for interactive and batch processing.
GPU Acceleration in ITK v4
Unsupervised Learning Clustering K-Means. Recall: Key Components of Intelligent Agents Representation Language: Graph, Bayes Nets, Linear functions Inference.
National Alliance for Medical Image Computing ITK The Image Segmentation and Registration Toolkit Julien Jomier Kitware Inc.
Desheng Liu, Maggi Kelly and Peng Gong Dept. of Environmental Science, Policy & Management University of California, Berkeley May 18, 2005 Classifying.
COMP 328: Final Review Spring 2010 Nevin L. Zhang Department of Computer Science & Engineering The Hong Kong University of Science & Technology
CSci 6971: Image Registration Lecture 6: Getting Started with ITK January 30, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart,
Clustering.
Evaluation of MineSet 3.0 By Rajesh Rathinasabapathi S Peer Mohamed Raja Guided By Dr. Li Yang.
CSci 6971: Image Registration Lecture 9: Registration Components February 10, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart,
CSci 6971: Image Registration Lecture 8: Image Resampling February 3, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart, RPI Dr.
CSci 6971: Image Registration Lecture 20: Demons Registration April 16, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart, RPI.
Exercise 10 Review: pointers, strings and recursion.
CSci 6971: Image Registration Lecture 10: Registration Components February 13, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart,
Command line arguments. – main can take two arguments conventionally called argc and argv. – Information regarding command line arguments are passed to.
Methods in Medical Image Analysis Statistics of Pattern Recognition: Classification and Clustering Some content provided by Milos Hauskrecht, University.
GPU Acceleration in ITK v4
Dr. Engr. Sami ur Rahman Assistant Professor Department of Computer Science University of Malakand Medical Imaging ITK.
Image Registration Lecture 7: Getting Started with ITK March 15, 2005 Prof. Charlene Tsai.
University of Calgary – CPSC 441. C PROGRAM  Collection of functions  One function “main()” is called by the operating system as the starting function.
NA-MIC National Alliance for Medical Image Computing Slicer3 and the NA-MIC kit Sonia Pujol, Ph.D. Instructor of Radiology Surgical Planning.
Image Classification 영상분류
ITK Input/Output Kitware Inc.. Overview IO Factory Mechanism Image File IO Transform File IO SpatialObject File IO Logger.
Programming into Slicer3. Sonia Pujol, Ph.D., Harvard Medical School -1- National Alliance for Medical Image Computing Programming into Slicer3 Sonia Pujol,
Today Ensemble Methods. Recap of the course. Classifier Fusion
ITK Introduction and Overview Spring Topics  What Is ITK History Features  Software Engineering Methodology.
1 Pattern Recognition: Statistical and Neural Lonnie C. Ludeman Lecture 24 Nov 2, 2005 Nanjing University of Science & Technology.
Optimal Bayes Classification
Non-Bayes classifiers. Linear discriminants, neural networks.
Slicer3 for developers – S.Pujol -1- National Alliance for Medical Image Computing Slicer3 Course for developers Sonia Pujol, Ph.D. Surgical Planning Laboratory.
Prototype Classification Methods Fu Chang Institute of Information Science Academia Sinica ext. 1819
Clustering Instructor: Max Welling ICS 178 Machine Learning & Data Mining.
Chapter 13 (Prototype Methods and Nearest-Neighbors )
Random Forests Ujjwol Subedi. Introduction What is Random Tree? ◦ Is a tree constructed randomly from a set of possible trees having K random features.
ITK Basic Filters Kitware Inc.. ITK Basic Filters Pixel-wise Arithmetic, Casting, Thresholding Mathematical morphology Noise reduction Gaussian, Anisotropic.
METU Informatics Institute Min720 Pattern Classification with Bio-Medical Applications Part 9: Review.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 2 September 3, 2009.
Read a DICOM File typedef unsigned charInputPixelType; const unsigned intInputDimension = 2; typedef itk::Image InputImageType; typedef itk::ImageFileReader.
 Memory setup  Pointer declaration  Address operator  Indirection  Printing addresses or pointers.
Iterative K-Means Algorithm Based on Fisher Discriminant UNIVERSITY OF JOENSUU DEPARTMENT OF COMPUTER SCIENCE JOENSUU, FINLAND Mantao Xu to be presented.
Given a set of data points as input Randomly assign each point to one of the k clusters Repeat until convergence – Calculate model of each of the k clusters.
Debrup Chakraborty Non Parametric Methods Pattern Recognition and Machine Learning.
Part 4: Contextual Classification in Remote Sensing * There are different ways to incorporate contextual information in the classification process. All.
Edge Preserving Spatially Varying Mixtures for Image Segmentation Giorgos Sfikas, Christophoros Nikou, Nikolaos Galatsanos (CVPR 2008) Presented by Lihan.
National Alliance for Medical Image Computing Slicer3 Plugins Common architecture for interactive and batch processing.
NA-MIC National Alliance for Medical Image Computing Three ways to use the NA-MIC kit Sonia Pujol, Ph.D. Instructor of Radiology Surgical.
National Alliance for Medical Image Computing Bayesian Classifier Image Filter John Georgia Tech Luis Kitware.
Pixel Purity Index Assumes spectrally “pure” pixels are likely to correspond to “in scene” end members   For i = 1 to N Randomly generate a unit vector.
Insight Toolkit Introduction Luis Ibáñez William Schroeder Insight Software Consortium.
ITKv4 DICOM Status Mathieu Malaterre, Mark Roden Alexandre Gouaillard, William Ryan, Daniel Blezek.
ITK Segmentation Methods
Command Line Arguments
Command line arguments
Command Line Arguments
Classification of unlabeled data:
Machine Learning Week 1.
Markov Random Fields for Edge Classification
ITK-Overview Insight Software Consortium.
ITK Architecture Kitware Inc..
ITK Workshop Software Design October 5-8, 2005.
Machine Learning Perceptron: Linearly Separable Supervised Learning
Extra C Material Based on material in: The C Programming Language, Second Edition by Brian W. Kernighan and Dennis M. Ritchie. Prentice Hall, Inc., 1988. 
Presentation transcript:

ITK Statistical Classification Kitware Inc.

Statistical Classification Multiple Components Images K-Means Markov Random Fields

Creating Images with Multiple Components

Multiple-Component Images 3 Images of 1 component per pixel 1 Image of 3 component per pixel

Image to Vector Image Filter #include "itkImage.h" #include "itkVectorImage.h" #include "itkImageFileReader.h“ #include "itkImageFileWriter.h" #include "itkImageToVectorImageFilter.h" int main( int argc, char * argv[] ) typedef itk::Image ImageType; typedef itk::ImageToVectorImageFilter FilterType; typedef FilterType::OutputImageType OutputImageType; typedef itk::ImageFileReader ReaderType; typedef itk::ImageFileWriter WriterType; FilterType::Pointer filter = FilterType::New();

Image to Vector Image Filter for (unsigned int k = 1; k < argc-1; k++ ) { ReaderType ::Pointer reader = ReaderType ::New(); reader->SetFileName( argv[ k ] ); reader->Update(); filter->SetNthInput( k-1, reader->GetOutput() ); } WriterType::Pointer writer = WriterType::New(); writer->SetInput( filter->GetOutput() ); writer->SetFileName( argv[ argc-1 ] ); writer->Update();

Image to Vector Image Filter Run Command: ConvertImagesToVectorImage brainweb165a10f17_Slice94.png brainweb1e1a10f20_Slice94.png brainweb1e5a10f17_Slice94.png brainwebSlice94.vtk In ParaView: Load the brainwebSlice94.vtk image Use the Calculator to verify the components

Exercise 36a

K-Means Classifier

Image K-Means Estimation N Components Image Image to List Adaptor List K-d Tree Generator K-d Tree K-Means Estimator K-d Tree Array of Means

Image K-Means Estimation #include "itkKdTree.h" #include "itkKdTreeBasedKmeansEstimator.h" #include "itkWeigthedCentroidKdTreeGenerator.h“ #include "itkImageToListAdaptor.h“ #include "itkImageFileReader.h“ #include "itkImage.h“ int main( int argc, char * argv[] ) { typedef itk::Vector PixelType; typedef itk::Image ImageType;

Image K-Means Estimation typedef itk::Statistics::ImageToListAdaptor AdaptorType; AdaptorType::Pointer adaptor = AdaptorType::New(); adaptor->SetImage( reader->GetOutput() ); typedef itk::Statistics::WeightedCentroidKdTreeGenerator< AdaptorType > TreeGeneratorType; TreeGeneratorType::Pointer treeGenerator = TreeGeneratorType::New(); treeGenerator->SetSample( adaptor ); treeGenerator->SetBucketSize( 16 ); treeGenerator->Update();

Image K-Means Estimation typedef TreeGeneratorType::KdTreeType TreeType; typedef itk:: Statistics:: KdTreeBasedKmeansEstimator EstimatorType; EstimatorType::Pointer estimator = EstimatorType::New(); EstimatorType::ParametersType initialMeans( NumberOfClasses * NumberOfComponents ); estimator->SetParameters( initialMeans ); estimator->SetKdTree( treeGenerator->GetOutput() ); estimator->SetMaximumIteration( 200 ); estimator->SetCentroidPositionChangesThreshold(0.0); estimator->StartOptimization(); EstimatorType::ParametersType estimatedMeans = estimator->GetParameters();

Image K-Means Estimation for ( unsigned int i = 0 ; i < numberOfClasses ; ++i ) { std::cout << "cluster[" << i << "] "; std::cout << " estimated mean : "; for ( unsigned int j = 0 ; j < NumberOfComponents ; ++j ) { std::cout << " " << estimatedMeans[ i * NumberOfComponents + j ]; } std::cout << std::endl; }

Vector Image K-Means Estimation Run Command: ImageKmeansModeleEstimator brainwebSlice94.vtk 4 Output: Locations of the Means in the N-Components Space

Exercise 36b

Image K-Means Estimation N Components Image Image to List Adaptor List K-d Tree Generator K-d Tree K-Means Estimator K-d Tree Array of Means itk::ImageKmeansImageFilter

Image K-Means Classification N Components Image Array of Means itk::ImageKmeansImageFilter …. Sample Classifier Decision Rule K-d Tree Membership Functions Membership Sample Image of Labels Label List

Image K-Means Classification #include "itkImage.h“ #include "itkImageFileReader.h“ #include "itkImageFileWriter.h“ #include "itkImageKmeansImageFilter.h“ int main( int argc, char * argv[] ) { typedef itk::Vector PixelType; typedef itk::Image ImageType;

Image K-Means Classification typedef itk:: ImageKmeansImageFilter KMeansFilterType; KMeansFilterType::Pointer kmeansFilter = KMeansFilterType::New(); kmeansFilter->SetInput( reader->GetOutput() ); kmeansFilter->SetUseNonContiguousLabels( useNonContiguousLabels ); KMeansFilterType::RealPixelType initialMean; initialMean.Fill(0.0); // N-Components array for( unsigned int cc = 0; cc < numberOfClasses; ++cc ) { kmeansFilter->AddClassWithInitialMean( initialMean ); }

Image K-Means Classification typedef KMeansFilterType::OutputImageType OutputImageType; typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); writer->SetInput( kmeansFilter->GetOutput() ); writer->Update(); KMeansFilterType::ParametersType estimatedMeans = kmeansFilter->GetFinalMeans(); // Array of NumberOfClasses X NumberOfComponents

Image K-Means Classification Run Command: ImageKmeansModeleClassifier brainwebSlice94.vtk labelsImage.vtk 4 0 Output: Locations of the Means in the N-components space Image of labels associated to classes

K-Means Classification Result

Exercise 36c

Markov Random Fields

N Components Image Number of Iterations Markov Random Fields Filter Error Tolerance Number of Classes Smoothing Factor Neighborhood Weights Image of Labels Classifier Markov Random Field Filter Neighborhood Radius

N Components Image Array of Means Image Classifier Decision Rule Membership Functions Image of Labels Markov Random Field Filter Markov Random Fields Filter

Markov Random Field Output Smoothing Factor = 1 Smoothing Factor = 10 Smoothing Factor = 20

Markov Random Field Classification #include "itkImage.h“ #include "itkImageFileReader.h“ #include "itkImageFileWriter.h“ #include "itkMRFImageFilter.h“ #include "itkDistanceToCentroidMembershipFunction.h“ #include "itkMinimumDecisionRule.h“ #include "itkImageClassifierBase.h“ int main( int argc, char * argv[] ) { typedef itk::Vector PixelType; typedef itk::Image ImageType;

typedef itk:: MRFImageFilter MarkovFilterType; MarkovFilterType::Pointer markovFilter = MarkovFilterType::New(); markovFilter->SetInput( reader->GetOutput() ); markovFilter->SetNumberOfClasses( numberOfClasses ); markovFilter->SetMaximumNumberOfIterations( maxNumberIterations ); markovFilter->SetSmoothingFactor( smoothingFactor ); markovFilter->SetErrorTolerance( 1e-7 ); markovFilter->SetNeighborhoodRadius( 1 ); markovFilter->SetMRFNeighborhoodWeight( weights ); markovFilter->Classifier( classifier ); writer->SetInput( markovFilter->GetOutput() ); Markov Random Field Classification

typedef itk:: ImageClassifierBase ClassifierType; ClassifierType::Pointer classifier = ClassifierType::New(); classifier->SetDecisionRule( reader->GetOutput() ); typedef itk:: Statistics:: DistanceToCentroidMembershipFunction MembershipFunctionType; MembershipFunctionType::Pointer membershipFunction; MembershipFunctionType ::New(); for( unsigned int cc = 0; cc < numberOfClasses; ++cc ) { membershipFunction = MembershipFunctionType ::New(); membershipFunction ->SetCentroid( classMean[cc] ); classifier->AddMembershipFunction( membershipFunction ); } Markov Random Field Classification

Markov Random Fields Run Command: ImageMarkovRandomField brainwebSlice94.vtk labelsImage.vtk outputLabelsImage.vtk means…. Output: Image of labels smoothed Termination criteria: (max num iterations or convergence)

Exercise 36d

Enjoy ITK !