SimpleITK/Advisory Review Board: Difference between revisions
From KitwarePublic
Jump to navigationJump to search
Line 20: | Line 20: | ||
// Read the image | // Read the image | ||
itk::simple::ImageFileReader reader; | itk::simple::ImageFileReader reader; | ||
itk::simple::Image::Pointer im = reader.execute("sample/path/to/image.jpg"); | itk::simple::Image::Pointer im = reader.execute( "sample/path/to/image.jpg" ); | ||
// Apply Gaussian with sigma = 2 | // Apply Gaussian with sigma = 2 | ||
itk::simple::Gaussian filter; | itk::simple::Gaussian filter; | ||
im = filter.execute(im, 2); | im = filter.execute( im, 2 ); | ||
// Write out the image | // Write out the image | ||
itk::simple::ImageFileWriter writer; | itk::simple::ImageFileWriter writer; | ||
writer.execute(im, "sample/path/to/output.png"); | writer.execute( im, "sample/path/to/output.png" ); | ||
</pre> | </pre> | ||
* '''Option 2 - Procedural with parameter setting''' | * '''Option 2 - Procedural with parameter setting''' | ||
Line 34: | Line 34: | ||
// Read the image | // Read the image | ||
itk::simple::ImageFileReader reader; | itk::simple::ImageFileReader reader; | ||
reader.SetFilename("sample/path/to/image.jpg"); | reader.SetFilename( "sample/path/to/image.jpg" ); | ||
itk::simple::Image::Pointer im = reader.execute(); | itk::simple::Image::Pointer im = reader.execute(); | ||
// Apply Gaussian with sigma = 2 | // Apply Gaussian with sigma = 2 | ||
itk::simple::Gaussian filter; | itk::simple::Gaussian filter; | ||
filter.SetSigma(2); | filter.SetSigma( 2 ); | ||
im = filter.execute(im); | im = filter.execute( im ); | ||
// Write out the image | // Write out the image | ||
itk::simple::ImageFileWriter writer; | itk::simple::ImageFileWriter writer; | ||
writer.SetFilename("sample/path/to/output.png"); | writer.SetFilename( "sample/path/to/output.png" ); | ||
writer.execute(im); | writer.execute( im ); | ||
</pre> | </pre> | ||
* '''Option 3 - Pipelined''' | * '''Option 3 - Pipelined''' | ||
<pre> | |||
// Read the image | |||
itk::simple::ImageFileReader reader; | |||
reader.SetFilename( "sample/path/to/image.jpg" ); | |||
// Apply Gaussian with sigma = 2 | |||
itk::simple::Gaussian filter; | |||
filter.SetSigma( 2 ); | |||
filter.SetInput( reader.getOutput() ); | |||
// Write out the image | |||
itk::simple::ImageFileWriter writer; | |||
writer.SetFilename( "sample/path/to/output.png" ); | |||
writer.SetInput( filter->GetOutput() ); | |||
// Update the pipieline | |||
writer.Update(); | |||
</pre> | |||
== Image Registration == | == Image Registration == |
Revision as of 19:30, 2 September 2010
- Harvey Cline, Kitware Inc.
- Raghu Machiraju, The State University of Ohio
- John Galeotti, CMU
- Hans Johnson, University of Iowa
- Fabrice de Chaumont, Pasteur Institute
- New students in the UNC CISMM project (taylorr@cs.unc.edu)
- Jesus Caban, NLM-NIH
ARB Prototype Code
Gaussian Filter
- Pseudocode
- Open Image
- Blur with Gaussian using sigma = 2
- Write out the image
- Option 1 - Fully procedural
// Read the image itk::simple::ImageFileReader reader; itk::simple::Image::Pointer im = reader.execute( "sample/path/to/image.jpg" ); // Apply Gaussian with sigma = 2 itk::simple::Gaussian filter; im = filter.execute( im, 2 ); // Write out the image itk::simple::ImageFileWriter writer; writer.execute( im, "sample/path/to/output.png" );
- Option 2 - Procedural with parameter setting
// Read the image itk::simple::ImageFileReader reader; reader.SetFilename( "sample/path/to/image.jpg" ); itk::simple::Image::Pointer im = reader.execute(); // Apply Gaussian with sigma = 2 itk::simple::Gaussian filter; filter.SetSigma( 2 ); im = filter.execute( im ); // Write out the image itk::simple::ImageFileWriter writer; writer.SetFilename( "sample/path/to/output.png" ); writer.execute( im );
- Option 3 - Pipelined
// Read the image itk::simple::ImageFileReader reader; reader.SetFilename( "sample/path/to/image.jpg" ); // Apply Gaussian with sigma = 2 itk::simple::Gaussian filter; filter.SetSigma( 2 ); filter.SetInput( reader.getOutput() ); // Write out the image itk::simple::ImageFileWriter writer; writer.SetFilename( "sample/path/to/output.png" ); writer.SetInput( filter->GetOutput() ); // Update the pipieline writer.Update();