Tuesday, April 17, 2018

Running Examples

Trying to get all the examples to work, from ITKWikiExamples-master download.

Trying -DCMAKE_CXX_FLAGS=-std=c++11 flag with example

ccmake -DCMAKE_CXX_FLAGS=-std=c++11 ../../WatershedImageFilter/

Following instructions on how to build an example from
https://itk.org/ITKExamples/Documentation/Build/index.html#build-individual-examples
Following to the t, where itk is installed.  But no test file was found.
Using the flag ccmake -DCMAKE_CXX_FLAGS=-std=c++11 .. in this attempt

Made master-cpopy of all examples.  Going to try running: ccmake -DCMAKE_CXX_FLAGS=-std=c++11 ../ to see if it will work.  Then to build the project, according the the website used: ccmake -DCMAKE_CXX_FLAGS=-std=c++11 -build . . In the bin folder, running ctest -V gives errors while running CTest.
    Going to redo the build project, and run make after doing so. cmake --build 17:29:53 - 17:53:56
run ctest -V got some kind of output!!!


master-flag for using ccmake with the visibility flag.  added set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wall") to the CMakeLists.txt got this idea from this github link.  master-flag going to use the commands the tutorial lists. cmake --build . 17:51:25 - 18:12:11


==========================

After doing make install with itk and vtk.  Getting files and instruction from this wiki. This time, building into example-build folder using ITKWikiExamples-master as the 'original' files ccmake -DCMAKE_CXX_FLAGS=-std=c++11 ../ITKWikiExamples-master/.  in the example-build folder, run make 20:31:38 - 20:52:20


Format keeper

Watershed links

Nicer looking site with blue border
https://itk.org/ITKExamples/src/Segmentation/Watersheds/SegmentWithWatershedImageFilter/Documentation.html

itk informaiton, linked from above
https://itk.org/Doxygen/html/classitk_1_1WatershedImageFilter.html

public wiki files, includes how to run the file
https://itk.org/Wiki/ITK/Examples/Segmentation/WatershedImageFilter



itk examples run

Copy .cxx file and CMakeLists.txt.  Setup bin folder, cmake the source and build. In terminal, get to bin folder, use make then./ the executable file.

Directions for how to run includes things on superbuild to link itk and vtk:
https://itk.org/Wiki/ITK/Examples/Instructions/ForUsers#Build_all_of_the_examples


Tried and work:
HelloWorld gave the expected output given on the website.


Installing itk again notes

My notes as I install itk again. Hopefully, this will make sense to me down the line.  A lot of the links were given to me to use as reference from Peter.
https://itk.org/Wiki/ITK/Complete_Setup

Getting sources
Already downloaded sources for itk and vtk.  Used git to get a clone of vtkdata 
On second thought. I'm going to start from scratch, following the steps from the tutorial.  The first step, get cvs. *side note* Might not need cvs for the itk and vtk download.  For the latest itk version, one should just download it from the website directly.

There is a homebrew formula for cvs! brew install cvs (still need to find a way to remove unbrewed dylibs... at a later date).   Followed the create a repository part of this site, to initiate cvs.

To make things simpler, going to follow the directions and commands listed on the complete setup page.

Checking out insight 00:55:17 - 00:56:20
Getting insight documentation 00:56:20 - 01:03:32
Getting demo applications 01:04:20 - 01:04:34

Checking out vtk 01:05:19 - 01:06:26
Getting VTKData 01:07:14 - 01:08:17

Getting CWWidgets 01:09:01 - 01:09:20


Compiling the sources
Had to get itk copy from the downloaded stuff from the original attempt (cmake -DCMAKE_CXX_FLAGS=-std=c++11 ../Insight) 01:14:13 - 01:20:19
     Didn't have to hit c or g.  Seems like the configure and generating was done automatically.
make 01:26:46 - 04:20:00
Used the wrong command above.  Use ccmake command instead. Turned on BUILD_EXAMPLES and Module_ITKVtkGlue. 12:03:05 - 12:11:44 make 12:12:06 - 12:59:05
After class 4/17 ran make install 20:09:46 - 20:11:36


Vtk used ccmake.  Marked BUILD_EXAMPLES, VTK_WRAP_TCL, Module_vtk_TestingCore, and Module_vtk_TestingRendering on.  I was not able to find VTK_USE_HYBRID. Seems like use hybrid was necessary for older versions. Decided to turn off VTK_WRAP_TCL, since ccmake kept telling me it has been deprecated. 14:46:23 - 12:52:52 A lot of the time, it was waiting for me.
Don't forget to run make!!!
After class 4/17 ran make install 20:11:48 - 20:12:26


From video: itk: BUILD_EXAMPLES, Module_ITKVtkGlue on. vtk: BUILD_EXAMPLES, (build_testing unchecked), (ignore missing modules) Module_vtk_TextingCore, Module_vtk_TestingRendering.

InsightApplications
The cvs version is an old version.  Looks like this just has a bunch of examples, so I'm going to try skipping it for now. Moving on...

KWWidgets
Need to set VTK_WRAP_TCL to on...
Going back to turn that back on. But when that is turned on, vtk doesn't like it. So back to reconfiguring vtk.  15:05:07 - 15:09:42
making vtk again 15:24:46 - 16:00:13

Skipping to running examples

Monday, April 16, 2018

Quick CMake Tutorial

Tutorial link

Notes:
Uses a single script to generate build scripts.  The first command in the root CMakeLists.txt is the minimum required CMake version, cmake_minimum_required(VERSION x.x.x). This is automatically done on CLion (the website this tutorial is from).  CMakeLists.txt should be in the root directory of all project-related files for CLion.
After the minimum required version, define the name of the project. A project is a collection of files that are somehow related.
You can create text variables by using the set() command.  To refer to the variable later on, enclose it in round braces prepended by a dollar sign. Ex:  set a variable MY_VAR with the value "hello" -> set (MY_VAR "hello")  set(OTHER_VAR "${MY_VAR} world!")
Header search paths let the compiler know where to search for headers.  The compiler starts searching in several predefined locations, based on the OS, and the user can specify further directories using include_directories(). Users can control the order of inclusion of the directories by using BEFORE and AFTER keywords. 
Can enable a particular language standard by using CMAKE_CXX_VARIABLE, which can also set up additional complier-related settings using CMAKE_CXX_FLAGS
Build targets define an executable or library that the CMake scrip helps build. One script can have more than one build target.  To create an executable binary, use add_executable() command.  Can build a library instead.  There are 3 kinds of library one can build.  STATIC a static library that gets embedded into the executable that decides to use it.  SHARED builds a shared library (.so or .dll depending on OS). MODULE builds a plugin library.  Don't need to link against, but it can load dynamically at runtime.
To include libraries, one needs to instruct the compiler to find the desired library and its components using find_package. In the example below, component1 and component2 are the required/mandatory components for a project, and opt_component is optional. Next, one needs to link an executable to the located library using target_link_libraries. 

Stopped at "Using Boost"

CMakeLists.txt (growing as I read through the site):
// specify minimum cMake version requirement
cmake_minimum_required(VERSION x.x.x)
// define name of project
project(MyProject)
// set example
set (MY_VAR "hello")
set (OTHER_VAR "${MY_VAR} world!")
// specifying header search paths
include_directories( ${MY_SOURCE_DIR}/src )
     // MY_SOURCE_DIR is the desired directory
// setting language standard
set(CMAKE_CXX_STANDARD 11) // enable c++11 standard
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wall")
     //telling the compiler to show all compiler errors/warnings.  To get latest versions of the compiler, use -std=c++1y, -std=c++1z, etc. 
add_executable (my_executable my_source1.cpp my_source2.cpp)
     // my_executable is the target name, *.cpp are the source files needed to make the executable
add_library (my_library STATIC|SHARED|MODULE my_surce.cpp)
     // to build a library instead
find_package (my_library COMPONENTS REQUIRED component1 component2 OPTIONAL_COMPONENTS opt_component)
target_link_libraries (my_target my_library another_library)
     // target_link_libraries() should be placed after add_executable() command

placeholder

Sunday, May 1, 2011

The Power of Books

For the longest time, I would not touch them. No matter if they were school books, or books people get me as gifts. It was not until the summer after fifth grade, when I took a speed reading class, when I really looked into reading. After that summer, I started reading more and more until I was constantly carrying a book with me everywhere I go. It wasn’t until high school that I started noticing patterns or groups of books that would capture my interest at different parts of my life. Depending on what kind of book it is, I realized that I should just buy it from the bookstore if possible. There is a list of books that I keep rereading time and time again.Sometimes I would reread the whole book, and other times, just certain passages of the book.

Thinking back to some of the unofficial groups I categorized books into, they change when my mood or stress change. The quick change does not really faze me because I already know how the book ends most of the time. But it is really annoying when it is a book I am reading for the first time. At first, I did not really understand why it happens. When I am really interested in a book, it seems like the pages just fly through, and after an hour or so, I am almost or totally done with a book. But when once my interest shifts, and I continue with the book, the story seems to stretch out, and the plot seems really boring all of a sudden.

Looking back to instances like that, I can see how reality came in and changed my overall mood all of a sudden. Some of the shifts were easy to see, and realize the reason for the sudden change, but most of time, I have to stop and really think before I am able to identify why I want to read that one group of books all of a sudden. The most obvious one comes out really strong during finals, midterms, or when school just seems really difficult for me, I would tend to read books where the main character has to deal with school, factors the author decides to write about, and finally triumphs at the end of the book or series. To me, the unconscious message is that I can overcome the obstacle, and finish my academic work, just like the characters in the book. While not all of changes can be identified like that, they are all really similar in what they convey to me unconsciously.

Tuesday, April 19, 2011

Perpectives

When trying to relate to people whose actions or beliefs I do not agree with, it really depends on the situation and the person. For people I am not really that close to, it is really easy to just brush or just ignore the action. Coworkers, or more casual acquaintances, it is more of a watch and learn from them kind of deal. Whereas for closer family members or friends, I would spend some time to see if there is a logical link that they see, but I did not at the time. As for beliefs, they really depend on what kind of belief.

A lot of times, when I see a complete stranger do something I do not really agree with I would just observe them and try to learn from what I see. On a semi-drizzling (or super foggy depending on terminology) day, I parked near a high school to finish eating before heading out to class. The next thing I know, a car pulls up next to the one I was in, and bumps into my car while getting out. I looked up, and saw that her body bumped into my car, but she did not seem to notice because she was busy yelling at the person who drove her to school. Watching that scene unfold in front of me like that, I realized how lucky I was in high school when I was able to get rides home. At first, I could not believe that someone would be yelling at the driver like that, especially when the driver probably had to

change their own schedule to drive her to school. Even though I did not get out of the car to approach her, I took note of how bad of an impression she left on me. There were times during high school when I was able to get a ride to my destination through family and friends, especially when it was raining. While I did not yell at them for the ride they gave me, I know that there were times when I forgot to thank them for helping me after a few rides. Through this scene, I realized how nice it would be for the person helping, if I thank them for helping me. Personally, I do not really yell at people (I may rant, but never really yell… yet) so I do not think I have to worry about me yelling at people, but there were times when I got a ride from someone, and just got out of the car when we got to the destination. From watching the way strangers act, I take notes on what I should or should not do in different situation. I know that there are times when I might act in a similar way to the people I observe, but I hope that the mental image of how it looks to an outsider will keep me from repeating their actions.

That is different from what I would do when it is a coworker or a friend (who is more like a casual friend). With the people I work with, I try to pay attention to my own obligations before really commenting on what other people do (at least at work). A few years ago, I ran into an elementary school classmate who was volunteering at a facility that I was interested in helping out in. She started telling me about which positions I should go for, because it is ‘easy’. There are some positions that would give volunteers more time to surf the internet and such while volunteering. She really liked the department she was volunteering in, because she was dealing with one child at a time, and more volunteers were allotted for the job than was needed. I listened while she was telling me about her experience in the different departments, nodded my head, and thanked her. After thinking about what she told me, and the way her life is, I realized that she was using the volunteering opportunity to relax and distress. When volunteering, or offering my help to people, I like to feel productive. So when I was ranking which departments I want to work with, I made sure to rank my friend’s suggestions last.

In general, I want to try to keep an objective perspective when doing things (when possible). That seemed like a good idea in the beginning, but later I realized how hard it is to actually follow through with that idea. I remember a saying someone told me that states something similar to: use the standard you use apply onto others (when looking for faults) on yourself, and use the standard you use for forgive yourself to forgive others. Keeping that saying in mind, I found that it was easier for me to remember that other people have their own reasons for doing things the way they do. It is through the combination of different perspectives that new ideas are developed. This semester, I was able to see how different ideas and perspectives can be combined into a better representation of a situation as a while.