[vtkusers] Compile VTK on VS2010

Massinissa Bandou Massinissa.Bandou at USherbrooke.ca
Thu Feb 9 15:10:26 EST 2012


Hi

I formatted my computer and successively Installed win7 Professionel  
64Bits instead of premium version which I had before and now  
everything is working Now, I can build ITK & VTK without problem!
I'm keeping to learn ITK & VTK According to this web site:  
http://www.itk.org/ITK/help/tutorials.html
I did the example of myProject.cxx of Getting Started II: Using ITK with VTK
It compiles with no error but when I run the executable, it crush  
instantly with an  error of invalid null pionter.
Do I need to add some C++ code to put an image (Brainslice.png) as an  
argument?
there is the original code:

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageToVTKImageFilter.h"
#include "vtkImageViewer.h"
#include "vtkRenderWindowInteractor.h"


int main( int argc, char **argv )
{

typedef itk::Image<unsigned short,2>     ImageType;
typedef itk::ImageFileReader<ImageType>  ReaderType;
typedef itk::ImageToVTKImageFilter< ImageType>   ConnectorType;

ReaderType::Pointer reader = ReaderType::New();
ConnectorType::Pointer connector = ConnectorType::New();

reader->SetFileName( argv[1] );
connector->SetInput( reader->GetOutput() );

vtkImageViewer * viewer = vtkImageViewer::New();

vtkRenderWindowInteractor * renderWindowInteractor =  
vtkRenderWindowInteractor::New();

viewer->SetupInteractor( renderWindowInteractor );
viewer->SetInput( connector->GetOutput() );

viewer->Render();
viewer->SetColorWindow( 255 );
viewer->SetColorLevel( 128 );
renderWindowInteractor->Start();

return 0;

}


Thank you for your help!

Massi


Alex Malyushytskyy <alexmalvtk at gmail.com> a écrit :

> If it is windows 7, make sure you start VS as administrator
> (running admin account  is not enough).
> I am not sure if this fix your problem, but I had weird problems which
> were gone after VS was started "as administrator"
> on windows 7.
>
> Alex
>
> On Fri, Jan 27, 2012 at 1:59 PM, Bill Lorensen  
> <bill.lorensen at gmail.com> wrote:
>> I suggest removing the build directory and trying again. I'm not sure
>> why you project files are corrupted. I not seen this before. Did you
>> run out of disk space?
>>  I build VS2010 Express often. Have never seen this problem.
>>
>>
>> 2012/1/27 Massinissa Bandou <Massinissa.Bandou at usherbrooke.ca>:
>>> Hello
>>>
>>> I'm using win7 64bits, Visual Studio 2010, I downloaded VTK 5.8.0 + the
>>> source and the data on this web site:
>>> http://www.vtk.org/VTK/resources/software.html#latest2
>>>
>>> I'm using Cmake 2.8.7
>>>
>>> I tried to compile VTK using CMake and VS2010 according to this web page
>>> http://www.divms.uiowa.edu/~cwyman/classes/common/howto/winVTK.html
>>>
>>> I REALLY want to compile some example and do some image processing!!!
>>> But when I try to build the 'ALL_BUILD' a pop-up appear saying:
>>> One or more projects in the solution were not loaded correctly.
>>>
>>> Example of error on the output window:
>>>
>>> :\Users\Massi\Desktop\VTK_BIN\ALL_BUILD.vcxproj : error  : Unable to read
>>> the project file "ALL_BUILD.vcxproj".
>>> C:\Users\Massi\Desktop\VTK_BIN\ALL_BUILD.vcxproj(157,417): The project file
>>> could not be loaded. An error occurred while parsing EntityName. Line 157,
>>> position 417.
>>>
>>> Only 72 projects are correctly loaded!!!!
>>>
>>>
>>> CAN anyone help me to figure out with this!!!!!
>>>
>>> Thank you for your help
>>>
>>> Massi
>>>
>>> _______________________________________________
>>> 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 VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>> _______________________________________________
>> 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 VTK FAQ at:  
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
>






More information about the vtkusers mailing list