ÌÌÌÌHi Luis,<br><br>In the CMakeLists.txt you sent me, I just changed the name of the files to "threshold" since I have "threshold.cxx" as my file name, and added the following lines similar to those in th CMakeLists.txt of the "/Examples/Segmentation" directory instead of the last two lines originally written:<br>
<br>ADD_EXECUTABLE(threshold threshold.cxx )<br>TARGET_LINK_LIBRARIES(threshold ITKNumerics ITKIO)<br><br>As in the original case, I got the following message when I tried to "configure" and also written in CMake was an error relating line12.<br>
<br><i>Error in configuration process, project files may be invalid<br><br></i>Now, I have made a "configure" and "generate" successfully.<br><br>In this file, I'm trying to replace the "CurvatureImageFlowFilter" with the "Anisotropic diffusion" filter from the "itkSoftwareGuide" (under section 6.7.3) and followed the steps on how to include it in the program.<br>
<br>The step left now is, how can test this filter on an .mha image?<br><br>I have attached the two files just to confirm if I have inserted the filter correct.<br><br>I know my questions may be basic but since I'm totally new seems a bit confusing at the beginning.<br>
<br>I really appreciate your kind patience and efforts.<br><br>Thanks a lot.<br><br>Abder-Rahman<br>
<br><br><div class="gmail_quote">On Sat, Mar 24, 2012 at 10:23 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Abder,<br>
<br>
Here is below the content that you<br>
need to put in the CMakeLists.txt file.<br>
<br>
Also attached for your convenience.<br>
<br>
Luis<br>
<br>
--<br>
<br>
cmake_minimum_required(VERSION 2.8)<br>
if(COMMAND CMAKE_POLICY)<br>
cmake_policy(SET CMP0003 NEW)<br>
endif(COMMAND CMAKE_POLICY)<br>
<br>
project(ConnectedThreshold)<br>
<br>
find_package(ITK REQUIRED)<br>
include(${ITK_USE_FILE})<br>
<br>
add_executable(ConnectedThreshold ConnectedThresholdImageFilter.cxx )<br>
target_link_libraries(ConnectedThreshold ${ITK_LIBRARIES})<br>
<br>
<br>
<br>
=================================================================<br>
On Sat, Mar 24, 2012 at 6:13 PM, Abder-Rahman Ali<br>
<div><div></div><div><<a href="mailto:abder.rahman.ali@gmail.com" target="_blank">abder.rahman.ali@gmail.com</a>> wrote:<br>
> Thanks so much Luis. That really helps.<br>
><br>
> I'm a bit new to this, and now trying to run a filter, say for example, the<br>
> "Examples/Segmentation/ConnectedThresholdImageFilter.cxx". I tried to use<br>
> CMake after copying this file along with the CMakeLists.txt to a new<br>
> directory. I made the new directory (i.e; NewDir) as "source" and the<br>
> "build" as (i.e; NewDirBin).<br>
><br>
> When I try to "generate", I get the following message: Error in generation<br>
> process, project files may be invalid<br>
><br>
> So, the bottom line is, how can I test this filter?<br>
><br>
> Thanks a lot.<br>
><br>
> Abder-Rahman<br>
><br>
><br>
> On Sat, Mar 24, 2012 at 9:58 PM, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>><br>
> wrote:<br>
>><br>
>> On Sat, Mar 24, 2012 at 2:19 PM, Abder-Rahman Ali<br>
>> <<a href="mailto:abder.rahman.ali@gmail.com" target="_blank">abder.rahman.ali@gmail.com</a>> wrote:<br>
>> ><br>
>> > So, in your modifications, I should REMOVE what has "-" and ADD what has<br>
>> > "+".<br>
>> ><br>
>><br>
>> Yes.<br>
>><br>
>> This is the typical format that you will<br>
>> see when you do a diff between two files.<br>
>><br>
>><br>
>> > * For, the following:<br>
>> ><br>
>> > smoothing->SetTimeStep( 0.025 );<br>
>> ><br>
>> > Why did you add ( 0.025 ) and not ( 0.125 )<br>
>> ><br>
>><br>
>> Because when you go from 2D to 3D the computation<br>
>> of the time step in the smoothing filter needs to be<br>
>> adjusted. Otherwise you will get a warning about the<br>
>> time step at 0.125 being unstable in 3D.<br>
>><br>
>><br>
>> > * For the following:<br>
>> ><br>
>> ><br>
>> > - const InternalPixelType lowerThreshold = atof( argv[5] );<br>
>> > - const InternalPixelType upperThreshold = atof( argv[6] );<br>
>> > + const InternalPixelType lowerThreshold = atof( argv[6] );<br>
>> > + const InternalPixelType upperThreshold = atof( argv[7] );<br>
>> ><br>
>> > Why had you to remove the first two lines and add [6] & [7]?<br>
>> ><br>
>><br>
>> Because the insertion of the seedZ argument<br>
>> in the command line displaces the two last<br>
>> arguments by one.<br>
>><br>
>><br>
>> > Thanks a lot, and appreciate your kind efforts.<br>
>> ><br>
>> > Abder-Rahman<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > On Sat, Mar 24, 2012 at 4:56 PM, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Hi Abder-Rahman,<br>
>> >><br>
>> >> Please find below the diffs that you have to apply to<br>
>> >> this example in order to make it work for 3D images.<br>
>> >><br>
>> >><br>
>> >> Thanks<br>
>> >><br>
>> >><br>
>> >> Luis<br>
>> >><br>
>> >><br>
>> >> diff --git a/Examples/Segmentation/ConnectedThresholdImageFilter.cxx<br>
>> >> b/Examples/Segmentation/ConnectedThresholdImageFilter.cxx<br>
>> >> index 5fdfb24..38ef54c 100644<br>
>> >> --- a/Examples/Segmentation/ConnectedThresholdImageFilter.cxx<br>
>> >> +++ b/Examples/Segmentation/ConnectedThresholdImageFilter.cxx<br>
>> >> @@ -95,11 +95,11 @@<br>
>> >><br>
>> >> int main( int argc, char *argv[])<br>
>> >> {<br>
>> >> - if( argc < 7 )<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<br>
>> >> upperThreshold" << std::endl;<br>
>> >> + std::cerr << " inputImage outputImage seedX seedY seedZ<br>
>> >> lowerThreshold upperThreshold" << std::endl;<br>
>> >> return 1;<br>
>> >> }<br>
>> >><br>
>> >> @@ -114,7 +114,7 @@ int main( int argc, char *argv[])<br>
>> >><br>
>> >> // Software Guide : BeginCodeSnippet<br>
>> >> typedef float InternalPixelType;<br>
>> >> - const unsigned int Dimension = 2;<br>
>> >> + const unsigned int Dimension = 3;<br>
>> >> typedef itk::Image< InternalPixelType, Dimension ><br>
>> >> InternalImageType;<br>
>> >> // Software Guide : EndCodeSnippet<br>
>> >><br>
>> >> @@ -217,7 +217,7 @@ int main( int argc, char *argv[])<br>
>> >><br>
>> >> // Software Guide : BeginCodeSnippet<br>
>> >> smoothing->SetNumberOfIterations( 5 );<br>
>> >> - smoothing->SetTimeStep( 0.125 );<br>
>> >> + smoothing->SetTimeStep( 0.025 );<br>
>> >> // Software Guide : EndCodeSnippet<br>
>> >><br>
>> >><br>
>> >> @@ -235,8 +235,8 @@ int main( int argc, char *argv[])<br>
>> >> //<br>
>> >> // Software Guide : EndLatex<br>
>> >><br>
>> >> - const InternalPixelType lowerThreshold = atof( argv[5] );<br>
>> >> - const InternalPixelType upperThreshold = atof( argv[6] );<br>
>> >> + const InternalPixelType lowerThreshold = atof( argv[6] );<br>
>> >> + const InternalPixelType upperThreshold = atof( argv[7] );<br>
>> >><br>
>> >> // Software Guide : BeginCodeSnippet<br>
>> >> connectedThreshold->SetLower( lowerThreshold );<br>
>> >> @@ -275,6 +275,7 @@ int main( int argc, char *argv[])<br>
>> >><br>
>> >> index[0] = atoi( argv[3] );<br>
>> >> index[1] = atoi( argv[4] );<br>
>> >> + index[2] = atoi( argv[5] );<br>
>> >><br>
>> >><br>
>> >> // Software Guide : BeginCodeSnippet<br>
>> >><br>
>> >><br>
>> >><br>
>> >> ---------------------------------<br>
>> >> On Sat, Mar 24, 2012 at 11:14 AM, Abder-Rahman Ali<br>
>> >> <<a href="mailto:abder.rahman.ali@gmail.com" target="_blank">abder.rahman.ali@gmail.com</a>> wrote:<br>
>> >> > Hello,<br>
>> >> ><br>
>> >> > I just have a question and thought you may have an idea on it.<br>
>> >> ><br>
>> >> > Inside the `InsightToolkit` directory there is the<br>
>> >> > `Examples/Segmentation/ConnectedThresholdImageFilter.xx` file.<br>
>> >> ><br>
>> >> > Now, I want to make it operate on a three dimensional image. In this<br>
>> >> > case,<br>
>> >> > will the changes that I have to do bee applied to those lines of code<br>
>> >> > (lines<br>
>> >> > 102-110):<br>
>> >> ><br>
>> >> > int main( int argc, char *argv[])<br>
>> >> > {<br>
>> >> > if( argc < 7 )<br>
>> >> > {<br>
>> >> > std::cerr << "Missing Parameters " << std::endl;<br>
>> >> > std::cerr << "Usage: " << argv[0];<br>
>> >> > std::cerr << " inputImage outputImage seedX seedY<br>
>> >> > lowerThreshold<br>
>> >> > upperThreshold" << std::endl;<br>
>> >> > return 1;<br>
>> >> > }<br>
>> >> ><br>
>> >> > And, in order to do that, should I add the following `seedZ` to:<br>
>> >> ><br>
>> >> > std::cerr << " inputImage outputImage seedX seedY lowerThreshold<br>
>> >> > upperThreshold" << std::endl;<br>
>> >> ><br>
>> >> > And, what change should I perform to the arguments in this case?<br>
>> >> ><br>
>> >> > Thanks a lot and apologize for my disturbance.<br>
>> >> ><br>
>> >> > Abder-Rahman<br>
>> >> ><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>