<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hi, <BR>
I´m new user, when I compile and execute ThresholdImageFilter.exe, nothing happens.<BR>
what I must change in the code to read an image(for example mri.png) that is in the same directory of the .exe and put the ouptfiles there too??<BR>
<BR>
Thanks!<BR>
<BR>
<BR>
/*=========================================================================<BR>
Program: Insight Segmentation & Registration Toolkit<BR> Module: $RCSfile: ThresholdImageFilter.cxx,v $<BR> Language: C++<BR> Date: $Date: 2005/08/31 13:55:22 $<BR> Version: $Revision: 1.28 $<BR>
Copyright (c) Insight Software Consortium. All rights reserved.<BR> See ITKCopyright.txt or <A href="http://www.itk.org/HTML/Copyright.htm">http://www.itk.org/HTML/Copyright.htm</A> for details.<BR>
This software is distributed WITHOUT ANY WARRANTY; without even <BR> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR <BR> PURPOSE. See the above copyright notices for more information.<BR>
=========================================================================*/<BR>#if defined(_MSC_VER)<BR>#pragma warning ( disable : 4786 )<BR>#endif<BR>
#ifdef __BORLANDC__<BR>#define ITK_LEAN_AND_MEAN<BR>#endif<BR>
<BR>
#include "itkThresholdImageFilter.h"<BR>// Software Guide : EndCodeSnippet<BR>
#include "itkImage.h"<BR>#include "itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"<BR>
int main( int argc, char *argv[])<BR>{<BR> <BR>
if( argc < 5 )<BR> {<BR> std::cerr << "Usage: " << argv[0] << " inputImageFile ";<BR> std::cerr << " outputImageFile1 outputImageFile2 outputImageFile3" << std::endl; <BR> return EXIT_FAILURE;<BR> }<BR> <BR> // Software Guide : BeginLatex<BR> //<BR> // Then we must decide what pixel type to use for the image. This filter is<BR> // templated over a single image type because the algorithm only modifies<BR> // pixel values outside the specified range, passing the rest through<BR> // unchanged.<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> typedef unsigned char PixelType;<BR> // Software Guide : EndCodeSnippet<BR>
// Software Guide : BeginLatex<BR> //<BR> // The image is defined using the pixel type and the dimension.<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> typedef itk::Image< PixelType, 2 > ImageType;<BR> // Software Guide : EndCodeSnippet<BR>
<BR> // Software Guide : BeginLatex<BR> //<BR> // The filter can be instantiated using the image type defined above.<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> typedef itk::ThresholdImageFilter< ImageType > FilterType;<BR> // Software Guide : EndCodeSnippet<BR>
<BR> // Software Guide : BeginLatex<BR> //<BR> // An \doxygen{ImageFileReader} class is also instantiated in order to read<BR> // image data from a file. <BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> typedef itk::ImageFileReader< ImageType > ReaderType;<BR> // Software Guide : EndCodeSnippet<BR>
// Software Guide : BeginLatex<BR> // <BR> // An \doxygen{ImageFileWriter} is instantiated in order to write the<BR> // output image to a file.<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> typedef itk::ImageFileWriter< ImageType > WriterType;<BR> // Software Guide : EndCodeSnippet<BR>
<BR>
// Software Guide : BeginLatex<BR> //<BR> // Both the filter and the reader are created by invoking their \code{New()}<BR> // methods and assigning the result to SmartPointers.<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> ReaderType::Pointer reader = ReaderType::New();<BR> FilterType::Pointer filter = FilterType::New();<BR> // Software Guide : EndCodeSnippet<BR>
WriterType::Pointer writer = WriterType::New();<BR> writer->SetInput( filter->GetOutput() );<BR> reader->SetFileName( argv[1] );<BR>
<BR> // Software Guide : BeginLatex<BR> // <BR> // The image obtained with the reader is passed as input to the<BR> // \doxygen{ThresholdImageFilter}.<BR> //<BR> // \index{itk::ThresholdImageFilter!SetInput()}<BR> // \index{itk::FileImageReader!GetOutput()}<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> filter->SetInput( reader->GetOutput() );<BR> // Software Guide : EndCodeSnippet<BR>
<BR> // Software Guide : BeginLatex<BR> // <BR> // The method \code{SetOutsideValue()} defines the intensity value to be<BR> // assigned to those pixels whose intensities are outside the range defined<BR> // by the lower and upper thresholds. <BR> // <BR> // \index{itk::ThresholdImageFilter!SetOutsideValue()}<BR> // \index{SetOutsideValue()!itk::ThresholdImageFilter}<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> filter->SetOutsideValue( 0 );<BR> // Software Guide : EndCodeSnippet<BR>
<BR> // Software Guide : BeginLatex<BR> // <BR> // The method \code{ThresholdBelow()} defines the intensity value below<BR> // which pixels of the input image will be changed to the \code{OutsideValue}.<BR> // <BR> // \index{itk::ThresholdImageFilter!ThresholdBelow()}<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> filter->ThresholdBelow( 180 );<BR> // Software Guide : EndCodeSnippet<BR>
// Software Guide : BeginLatex<BR> // <BR> // The filter is executed by invoking the \code{Update()} method. If the<BR> // filter is part of a larger image processing pipeline, calling<BR> // \code{Update()} on a downstream filter will also trigger update of this<BR> // filter.<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> filter->Update();<BR> // Software Guide : EndCodeSnippet<BR>
<BR> writer->SetFileName( argv[2] );<BR> writer->Update();<BR>
<BR> // Software Guide : BeginLatex<BR> // <BR> // The output of this example is shown in<BR> // Figure~\ref{fig:ThresholdTransferFunctionBelow}. The second operating mode of<BR> // the filter is now enabled by calling the method<BR> // \code{ThresholdAbove()}.<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> filter->ThresholdAbove( 180 );<BR> filter->Update();<BR> // Software Guide : EndCodeSnippet<BR>
<BR> writer->SetFileName( argv[3] );<BR> writer->Update();<BR>
// Software Guide : BeginLatex<BR> // <BR> // Updating the filter with this new setting produces the output shown in<BR> // Figure~\ref{fig:ThresholdTransferFunctionAbove}. The third operating<BR> // mode of the filter is enabled by calling \code{ThresholdOutside()}.<BR> //<BR> // Software Guide : EndLatex <BR>
// Software Guide : BeginCodeSnippet<BR> filter->ThresholdOutside( 170,190 );<BR> filter->Update();<BR> // Software Guide : EndCodeSnippet<BR>
<BR> writer->SetFileName( argv[4] );<BR> writer->Update();<BR>
<BR> // Software Guide : BeginLatex<BR> // <BR> // The output of this third, ``band-pass'' thresholding mode is shown in<BR> // Figure~\ref{fig:ThresholdTransferFunctionOutside}.<BR> //<BR> // The examples in this <BR> // section also illustrate the limitations of the thresholding filter for performing<BR> // segmentation by itself. These limitations are particularly noticeable<BR> // in noisy images and in images lacking spatial uniformity, as is the case<BR> // with MRI due to field bias.<BR> //<BR> // \relatedClasses<BR> // \begin{itemize}<BR> // \item \doxygen{BinaryThresholdImageFilter}<BR> // \end{itemize}<BR> //<BR> // Software Guide : EndLatex <BR>
<BR> return EXIT_SUCCESS;<BR>}<BR>
<BR><br /><hr />Sigue los principales acontecimientos deportivos en directo. <a href='http://video.msn.com/video.aspx?mkt=es-es' target='_new'>MSN Motor</a></body>
</html>