<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7650.28">
<TITLE>Help with Connected Threshold Filter</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hi all,<BR>
<BR>
I am doing connected threshold filter on a Analyze dataset. However, I keep on gettin black outputs no matter what threshold range and seed point i specify. Can someone help me out with this?<BR>
<BR>
my input commands:<BR>
<BR>
ConnectedThresholdImageFilter MRI2.hdr output.hdr 295 221 250 255 95<BR>
<BR>
I initially placed my seed point at (221,250,95) where the image intensity is bright (250-255)<BR>
<BR>
my code attached:<BR>
<BR>
#if defined(_MSC_VER)<BR>
#pragma warning ( disable : 4786 )<BR>
#endif<BR>
<BR>
#ifdef __BORLANDC__<BR>
#define ITK_LEAN_AND_MEAN<BR>
#endif<BR>
<BR>
#include "itkConnectedThresholdImageFilter.h"<BR>
#include "itkImage.h"<BR>
#include "itkCastImageFilter.h"<BR>
#include "itkCurvatureFlowImageFilter.h"<BR>
#include "itkImageFileReader.h"<BR>
#include "itkImageFileWriter.h"<BR>
<BR>
<BR>
int main( int argc, char *argv[])<BR>
{<BR>
if( argc < 8 )<BR>
{<BR>
std::cerr << "Missing Parameters " << std::endl;<BR>
std::cerr << "Usage: " << argv[0];<BR>
std::cerr << " inputImage outputImage seedX seedY lowerThreshold upperThreshold seedZ" << std::endl;<BR>
return 1;<BR>
}<BR>
<BR>
typedef float InternalPixelType;<BR>
const unsigned int Dimension = 3;<BR>
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<BR>
<BR>
typedef unsigned char OutputPixelType;<BR>
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<BR>
typedef itk::CastImageFilter< InternalImageType, OutputImageType ><BR>
CastFilterType;<BR>
CastFilterType::Pointer caster = CastFilterType::New();<BR>
<BR>
typedef itk::ImageFileReader< InternalImageType > ReaderType;<BR>
typedef itk::ImageFileWriter< OutputImageType > WriterType;<BR>
<BR>
ReaderType::Pointer reader = ReaderType::New();<BR>
<BR>
WriterType::Pointer writer = WriterType::New();<BR>
<BR>
reader->SetFileName( argv[1] );<BR>
<BR>
writer->SetFileName( argv[2] );<BR>
<BR>
typedef itk::CurvatureFlowImageFilter< InternalImageType, InternalImageType ><BR>
CurvatureFlowImageFilterType;<BR>
<BR>
CurvatureFlowImageFilterType::Pointer smoothing =<BR>
CurvatureFlowImageFilterType::New();<BR>
<BR>
typedef itk::ConnectedThresholdImageFilter< InternalImageType,<BR>
InternalImageType > ConnectedFilterType;<BR>
<BR>
ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();<BR>
<BR>
smoothing->SetInput( reader->GetOutput() );<BR>
<BR>
connectedThreshold->SetInput( smoothing->GetOutput() );<BR>
caster->SetInput (connectedThreshold->GetOutput());<BR>
writer->SetInput ( caster->GetOutput());<BR>
<BR>
smoothing->SetNumberOfIterations( 1 );<BR>
smoothing->SetTimeStep( 0.0625 );<BR>
<BR>
const InternalPixelType lowerThreshold = atof( argv[5] );<BR>
const InternalPixelType upperThreshold = atof( argv[6] );<BR>
<BR>
connectedThreshold->SetLower( lowerThreshold );<BR>
connectedThreshold->SetUpper( upperThreshold );<BR>
<BR>
connectedThreshold->SetReplaceValue( 255 );<BR>
<BR>
InternalImageType::IndexType index;<BR>
<BR>
index[0] = atoi( argv[3] );<BR>
index[1] = atoi( argv[4] );<BR>
index[2] = atoi( argv[7] );<BR>
<BR>
connectedThreshold->SetSeed( index );<BR>
<BR>
try<BR>
{<BR>
writer->Update();<BR>
}<BR>
catch( itk::ExceptionObject & excep )<BR>
{<BR>
std::cerr << "Exception caught !" << std::endl;<BR>
std::cerr << excep << std::endl;<BR>
}<BR>
<BR>
return 0;<BR>
}<BR>
<BR>
<BR>
Appreciate the help!<BR>
<BR>
ZHeying<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>