[Insight-users] Segmentation of 3D image (itk)

Abder-Rahman Ali abder.rahman.ali at gmail.com
Sat Mar 24 14:19:04 EDT 2012


Hi Luis,

Thanks so much for your kind reply.

I just have some small questions:

* For the following (Just for confirmation):

-  if (argc < 7)
+ if (argc < 8)

I should REMOVE *if(argc<7)* and JUST write *if (argc < 8)*?

So, in your modifications, I should REMOVE what has "-" and ADD what has
"+".

* For, the following:

smoothing->SetTimeStep( 0.025 );

Why did you add ( 0.025 ) and not ( 0.125 )

* For the following:

-  const InternalPixelType lowerThreshold = atof( argv[5] );
-  const InternalPixelType upperThreshold = atof( argv[6] );
+  const InternalPixelType lowerThreshold = atof( argv[6] );
+  const InternalPixelType upperThreshold = atof( argv[7] );

Why had you to remove the first two lines and add [6] & [7]?

Thanks a lot, and appreciate your kind efforts.

Abder-Rahman





On Sat, Mar 24, 2012 at 4:56 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120324/b9db524e/attachment.htm>


More information about the Insight-users mailing list