[Insight-users] Segmentation of 3D image (itk)
Luis Ibanez
luis.ibanez at kitware.com
Sat Mar 24 12:56:31 EDT 2012
Hi Abder-Rahman,
Please find below the diffs that you have to apply to
this example in order to make it work for 3D images.
Thanks
Luis
diff --git a/Examples/Segmentation/ConnectedThresholdImageFilter.cxx
b/Examples/Segmentation/ConnectedThresholdImageFilter.cxx
index 5fdfb24..38ef54c 100644
--- a/Examples/Segmentation/ConnectedThresholdImageFilter.cxx
+++ b/Examples/Segmentation/ConnectedThresholdImageFilter.cxx
@@ -95,11 +95,11 @@
int main( int argc, char *argv[])
{
- if( argc < 7 )
+ if( argc < 8 )
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
- std::cerr << " inputImage outputImage seedX seedY lowerThreshold
upperThreshold" << std::endl;
+ std::cerr << " inputImage outputImage seedX seedY seedZ
lowerThreshold upperThreshold" << std::endl;
return 1;
}
@@ -114,7 +114,7 @@ int main( int argc, char *argv[])
// Software Guide : BeginCodeSnippet
typedef float InternalPixelType;
- const unsigned int Dimension = 2;
+ const unsigned int Dimension = 3;
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
// Software Guide : EndCodeSnippet
@@ -217,7 +217,7 @@ int main( int argc, char *argv[])
// Software Guide : BeginCodeSnippet
smoothing->SetNumberOfIterations( 5 );
- smoothing->SetTimeStep( 0.125 );
+ smoothing->SetTimeStep( 0.025 );
// Software Guide : EndCodeSnippet
@@ -235,8 +235,8 @@ int main( int argc, char *argv[])
//
// Software Guide : EndLatex
- const InternalPixelType lowerThreshold = atof( argv[5] );
- const InternalPixelType upperThreshold = atof( argv[6] );
+ const InternalPixelType lowerThreshold = atof( argv[6] );
+ const InternalPixelType upperThreshold = atof( argv[7] );
// Software Guide : BeginCodeSnippet
connectedThreshold->SetLower( lowerThreshold );
@@ -275,6 +275,7 @@ int main( int argc, char *argv[])
index[0] = atoi( argv[3] );
index[1] = atoi( argv[4] );
+ index[2] = atoi( argv[5] );
// Software Guide : BeginCodeSnippet
---------------------------------
On Sat, Mar 24, 2012 at 11:14 AM, Abder-Rahman Ali
<abder.rahman.ali at gmail.com> wrote:
> Hello,
>
> I just have a question and thought you may have an idea on it.
>
> Inside the `InsightToolkit` directory there is the
> `Examples/Segmentation/ConnectedThresholdImageFilter.xx` file.
>
> Now, I want to make it operate on a three dimensional image. In this case,
> will the changes that I have to do bee applied to those lines of code (lines
> 102-110):
>
> int main( int argc, char *argv[])
> {
> if( argc < 7 )
> {
> std::cerr << "Missing Parameters " << std::endl;
> std::cerr << "Usage: " << argv[0];
> std::cerr << " inputImage outputImage seedX seedY lowerThreshold
> upperThreshold" << std::endl;
> return 1;
> }
>
> And, in order to do that, should I add the following `seedZ` to:
>
> std::cerr << " inputImage outputImage seedX seedY lowerThreshold
> upperThreshold" << std::endl;
>
> And, what change should I perform to the arguments in this case?
>
> Thanks a lot and apologize for my disturbance.
>
> Abder-Rahman
>
-------------- next part --------------
diff --git a/Examples/Segmentation/ConnectedThresholdImageFilter.cxx b/Examples/Segmentation/ConnectedThresholdImageFilter.cxx
index 5fdfb24..38ef54c 100644
--- a/Examples/Segmentation/ConnectedThresholdImageFilter.cxx
+++ b/Examples/Segmentation/ConnectedThresholdImageFilter.cxx
@@ -95,11 +95,11 @@
int main( int argc, char *argv[])
{
- if( argc < 7 )
+ if( argc < 8 )
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
- std::cerr << " inputImage outputImage seedX seedY lowerThreshold upperThreshold" << std::endl;
+ std::cerr << " inputImage outputImage seedX seedY seedZ lowerThreshold upperThreshold" << std::endl;
return 1;
}
@@ -114,7 +114,7 @@ int main( int argc, char *argv[])
// Software Guide : BeginCodeSnippet
typedef float InternalPixelType;
- const unsigned int Dimension = 2;
+ const unsigned int Dimension = 3;
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
// Software Guide : EndCodeSnippet
@@ -217,7 +217,7 @@ int main( int argc, char *argv[])
// Software Guide : BeginCodeSnippet
smoothing->SetNumberOfIterations( 5 );
- smoothing->SetTimeStep( 0.125 );
+ smoothing->SetTimeStep( 0.025 );
// Software Guide : EndCodeSnippet
@@ -235,8 +235,8 @@ int main( int argc, char *argv[])
//
// Software Guide : EndLatex
- const InternalPixelType lowerThreshold = atof( argv[5] );
- const InternalPixelType upperThreshold = atof( argv[6] );
+ const InternalPixelType lowerThreshold = atof( argv[6] );
+ const InternalPixelType upperThreshold = atof( argv[7] );
// Software Guide : BeginCodeSnippet
connectedThreshold->SetLower( lowerThreshold );
@@ -275,6 +275,7 @@ int main( int argc, char *argv[])
index[0] = atoi( argv[3] );
index[1] = atoi( argv[4] );
+ index[2] = atoi( argv[5] );
// Software Guide : BeginCodeSnippet
More information about the Insight-users
mailing list