[Insight-users] Compiling ITK with Visual Studio 2010 - First Steps
emreturkoz
emreturkoz at gmail.com
Sun Jul 31 10:43:21 EDT 2011
Hi,
I'm trying to make ITK projects using Visual Studio 2010. I'm not using
CMAKE, I include the necessary files from VC++ Directories tab in the
properties and include the necessary libraries using a header file with
pragmas. It works at VTK so I expect it also to work with ITK.
I managed to compile the basic HelloWorld example.
The problem I suffer is that when I try to compile the basic
SimpleOperations/WidthHeight example at ITK Wiki, I get the errors regarding
"std::" commands. After I include several files ITK started to have
different "std::" functions other than the standard version.
My code is below. "project.config.h" contains pragmas to necessary
libraries.
Thank you for your help.
#include "itkImage.h"
#include "project_config.h"
#include <itkImageFileReader.h>
#include <iostream>
int main(){
std::string filename="logo_alone.png";
typedef itk::Image<float, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( filename.c_str() );
reader->Update();
std::cout << reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]
<< " "
<< reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]
<< std::endl;
// An example image had w = 200 and h = 100 (it is wider than it is tall).
The above output
// 200 100
// so w = GetSize()[0]
// and h = GetSize()[1]
// A pixel inside the region
itk::Index<2> indexInside;
indexInside[0] = 150;
indexInside[1] = 50;
std::cout <<
reader->GetOutput()->GetLargestPossibleRegion().IsInside(indexInside) <<
std::endl;
// A pixel outside the region
itk::Index<2> indexOutside;
indexOutside[0] = 50;
indexOutside[1] = 150;
std::cout <<
reader->GetOutput()->GetLargestPossibleRegion().IsInside(indexOutside) <<
std::endl;
// This means that the [0] component of the index is referencing the left
to right (x) value
// and the [1] component of Index is referencing the top to bottom (y)
value
return EXIT_SUCCESS;
}
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Compiling-ITK-with-Visual-Studio-2010-First-Steps-tp6638347p6638347.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list