[Insight-users] Error

Luis Ibanez luis.ibanez at kitware.com
Sun Aug 16 12:42:25 EDT 2009


Hi Suchita,


       You are not following the step-by-step instructions
       given in the Tutorial.


You should do:


   - Create a source directory outside of ITK
   (Let's say C:\ITKExample1Source)
   - Create a binary directory outside of ITK
   (Let's say C:\ITKExample1Binary)
   - Copy the example that you want to run into the Source directory. For
   example, copy "Examples\Image\Image1.cxx" to "C:\ITKExample1Source"
   - Open a Text editor and write a CMakeLists.txt file, that you will put
   in "C:\ITKExample1Source".
   - The content of the CMakeLists.txt file should be

   - CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
      IF(COMMAND CMAKE_POLICY)
        CMAKE_POLICY(SET CMP0003 NEW)
      ENDIF(COMMAND CMAKE_POLICY)
      PROJECT(Example1)

      FIND_PACKAGE(ITK REQUIRED)
      INCLUDE(${ITK_USE_FILE})

      ADD_EXECUTABLE(Image1 Image1.cxx )
      TARGET_LINK_LIBRARIES(Image1 ITKCommon)

      - Run CMake
      - Provide C:\ITKExample1Source as the directory where the sources are
      - Provide C:\ITKExample1Binary as the directory where the binaries
      will be build
      - In the ITK_DIR directory, provide the directory where you built ITK.
      - Configure
      - Generate
   - Open the solution file: C:\ITKExample1Binary/Image1.sln with Visual
   Studio
   - Select "Build" (or hit F7).
   - This should build the project
   - Open the command line prompt (as shown in the video)
   - cd to C:\ITKExample1Binary
   - in the Release or Debug sub-directory you should find the executable
   file Image1.exe
   - type "Image1.exe"
   - this should run the example
   - Note that Image1.cxx doesn't print any output. You will have to add
   some std::cout messages in order to make it more interesting.


You can now repeat this process with any other example.
The ones in Examples/IO and Examples/Filtering will be
more interesting, they will require inputs.  You will find
convenient input images in

      Insight/Examples/Data

For example, you can run the Median image filter by using

    Insight/Examples/Filtering/MedianImageFilter.cxx

following the process above, and then running the executable
from the command prompt by typing:

MedianImageFilter.exe  BrainProtonDensitySlice.png Median.png

Note that you may have to copy the input image from the

Insight/Examples/Data directory, into the binary directory where
you have the executable.


    Regards,


            Luis



----------------------------------------------------
On Sun, Aug 16, 2009 at 12:02 PM, Suchita Manandhar <
suchitamanandhar at hotmail.com> wrote:

>  Hey Luis,
>
> Yah I have been following that tutorials and ofcourse I am going through
> that link too. But If my program error is like:
>
> can't open the "itkImage.h" file or something related with header files,
> How do I include those files. Well Those files are already in
> ..\ITK\InsightToolkit\Code\Common right. And my program is
> ..\ITK\InsightToolKit\Examples\Image\Image1.cxx. Now When I try to build
> Image1.cxx, it says "itkImage.h" couldn't be found. So to avoid this
> problem, Do I have to change the path in CMakeLists.txt or in program. Well
> in the Image1.cxx, there just we have to do is include ItkImage.h as
> "#include "itkImage.h" ". But still it is giving the same problem. So in
> that case, Do we have to change something in CMakeLists.txt like as below:
>
>
> ADD_EXECUTABLE(Image1 Image1.cxx )
> TARGET_LINK_LIBRARIES(Image1 ITKCommon)
>
> in this part of code in the CMakeLists, do we have to change anywhere.
> TARGET_LINK_LIBRARIES(Image1 ITKCommon), in this one this ITKCommon is the
> one which is the link to header file right. so I tried giving the full path
> for the common folder. Whats that all about. How to solve this. I am so
> sorry I am still confused with this.
>
>
> Thank you
>
>
> Regards
>
> suchita
>
>
>
> ------------------------------
> Date: Sun, 16 Aug 2009 11:07:08 -0400
>
> Subject: Re: [Insight-users] Error
> From: luis.ibanez at kitware.com
> To: suchitamanandhar at hotmail.com
> CC: Insight-users at itk.org
>
>
>
> Hi Suchita,
>
>
> Yes, it makes a difference to run a program by directly double clicking
> on the .exe file, or running it from the command line.
>
> The difference is that in the first case you don't have a mechanism for
> passing the command line arguments to the program, while in the second
> case you can.
>
> Your situation illustrates the pernicious effect that GUIs have on users.
> They prevent you from understanding how the essential element of software
> works, and create an environment of ignorance and dependency.
>
> We have an entire generation of developers who don't know what
> command line arguments are, and who are ignorant of what really
> happens below the surface of the Windows interface.
>
>
>           There is not much that we can do for you
>           if you are not interested in learning....
>
>
> Regarding the new question that you post in the second part of your
> email: That's the consequence of trying to build an application by
> default from the Visual Studio interface, instead of configuring it
> with CMake.
>
>
>      You will have to first decide if you really want to learn.
>
>
> After that you may benefit from following the Tutorials:
>
> http://www.itk.org/ITK/help/tutorials.html
>
> In  particular, you should read:
> http://www.itk.org/CourseWare/Training/GettingStartedI-WebPage/index.htm
>
>
>       Regards,
>
>
>              Luis
>
>
>
> --------------------------------------------------------------------------------
> On Sun, Aug 16, 2009 at 10:41 AM, Suchita Manandhar <
> suchitamanandhar at hotmail.com> wrote:
>
> Hello Luis,
>
> Thanks for the link. But it doesn't solve my problem. I think it shouldn't
> make any difference if i directly click .exe file or use command prompt to
> run it. But in both case, the same thing. Well So I again tried from the
> beginning. This time I tried to run Data Representation/Image files. I ran
> CMake and configured it. It was ok with this. Configuration successful. Then
> I tried to build the .sln file. It showed "stdafx.h" file missing. Then I
> included this in all the file and rebuilded it. Then again it showed:can't
> open include file itkImage.h,itkTestMain.h ,itkVector.h .Now how to solve
> this. where and how shall i include those file ? What Should I do to solve
> this problem.
>
> Thanks
>
> Regards,
> Suchita
>
>
>
>
> ------------------------------
> Date: Sat, 15 Aug 2009 23:04:20 -0400
>
> Subject: Re: [Insight-users] Error
> From: luis.ibanez at kitware.com
> To: suchitamanandhar at hotmail.com
> CC: Insight-users at itk.org
>
>
> Hi Suchita,
>
> Please watch this instructional video in Youtube:
>
>
> http://www.youtube.com/watch?v=foYsmpDrYjY&feature=PlayList&p=6D392A9F3AD04537&playnext=1&playnext_from=PL&index=57
>
> and read the Wikipedia page:
>
> http://en.wikipedia.org/wiki/Command_Prompt_(Windows)<http://en.wikipedia.org/wiki/Command_Prompt_%28Windows%29>
>
> and look at the list DOS commands that you can
> use in the command prompt:
>
> http://en.wikipedia.org/wiki/List_of_DOS_commands
>
> In particular you need to learn:
>
>
>    - cd
>    - dir
>    - del
>    - copy
>    - set
>
>
> Once you get familiar with the command prompt,
> you should do:
>
>
>    - "cd" to the binary directory where you build your example
>    - type "dir" and locate the .exe file
>    - type the name of the executable followed by the command line
>    arguments.
>
>
>
> Regards,
>
>
>        Luis
>
> ---------------------------------
> On Sat, Aug 15, 2009 at 10:55 PM, Suchita Manandhar <
> suchitamanandhar at hotmail.com> wrote:
>
> Hello Luis,
>
> Well Can you please help me how can I run those programs from the command
> line then. I have been using Windows vista and i am using Visual C++.Net. I
> opened the console application and tried to run these programs. Can you
> refer any links so that I can get into those.
>
> Thanks
>
> suchita
>
>
>
> ------------------------------
> Date: Sat, 15 Aug 2009 20:07:44 -0400
> Subject: Re: [Insight-users] Error
> From: luis.ibanez at kitware.com
> To: suchitamanandhar at hotmail.com
> CC: insight-users at itk.org
>
>
> Hi Suchita,
>
> All the Examples in ITK are are intended to be run
> from the command line.
>
> Please get familiar with the process of calling
> command line programs in your platform.
>
>
>      Regards,
>
>
>            Luis
>
>
> -----------------------------------------------------
> On Mon, Aug 10, 2009 at 10:23 PM, Suchita Manandhar <
> suchitamanandhar at hotmail.com> wrote:
>
>
> Hello ,
>
>
> I have some error running the program...I tried to run
> BinaryMediumImageFilter.cxx file. But it is giving error. In the code
> section, there is
>
> if( argc < 4 )
>     {
>     std::cerr << "Usage: " << std::endl;
>     std::cerr << argv[0] << "  inputImageFile outputImageFile radiusX
> radiusY" << std::endl;
>     return EXIT_FAILURE;
>     }
>
>
> and my program just executes this part and throw error. How to solve this ?
>
>
>
> Thank you
> suchita
>
>
>
> ------------------------------
> Get free photo software from Windows Live Click here.<http://www.windowslive.com/online/photos?ocid=PID23393::T:WLMTAGL:ON:WL:en-US:SI_PH_software:082009>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
> ------------------------------
> Get your vacation photos on your phone! Click here.<http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL-HM>
>
>
>
>  ------------------------------
> Hotmail® is up to 70% faster. Now good news travels really fast. Try it
> now.<http://windowslive.com/online/hotmail?ocid=PID23391::T:WLMTAGL:ON:WL:en-US:WM_HYGN_faster:082009>
>
>
>
> ------------------------------
> Get back to school stuff for them and cashback for you. Try BingT now.<http://www.bing.com/cashback?form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090816/1638ed17/attachment.htm>


More information about the Insight-users mailing list