Friday, 14 December 2007

Showing an Image in VTK

Oh, at last I did it. I don't know why people say who an image can be shown in VTK straight forward. But here it is at last.

The piece of code is written by TCL , using vtk. The brain.tif is in the same directory as the tcl file.


 

# create image reader

#source object for reading tiff files

vtkTIFFReader tiffR

tiffR SetFileName brain.tif


 

#tiffR Update

#vtkImageViewer is a convenience class for displaying a 2d image.

#It packages up the functionality found in vtkRenderWindow, vtkRenderer, vtkActor2D and vtkImageMapper into a single easy to use class.

#Behind the scenes these four classes are actually used to to provide the required functionality. vtkImageViewer is simply a wrapper around them.

vtkImageViewer vw

vw SetInput [ tiffR GetOutput ]

#set the slice to be viewed

vw SetZSlice 0

vw SetColorLevel 128

vw SetColorWindow 255

vw Render


 

wm withdraw .

vwait forever


 

Tuesday, 4 December 2007

My second attempt using C++ on Visual studio 2005

#include
"stdafx.h"


 

#using
<mscorlib.dll>

using
namespace System;

int _tmain(int argc, _TCHAR* argv[])

{

    Console::WriteLine("Welcome to visual C++");

    return 0;

}

Well, yes that was the piece of code I was stuck on and because I was using Vista, I thought it's not completely updated or something. The error message I was getting was:

fatal error C1190: managed targeted code requires '#using ' and '/clr' option

I don't know what /clr is or "Common Language Runtime", I might write it down here later when I figure out. Anyway to fix this you need to change Common Language Runtime option which right now is not set. That's why you're getting an error.

To fix it (in Visual Studio 2005) right click on the project name in the solution menu and choose properties. In the General sort of tab thing change the value of "Common Language Runtime support" to what ever you want, "Pure MSIL Common Language Runtime Support (/clr pure)" worked for me

My first attempt in using C++ in Visual studio 2005

Well I guess I just Thought I install it on my new laptop WHICH CAME WITH A VISTA And this VISTA thing I guess made every thing go wrong. Well I tried to install it over and over and over but each time at some different point I got this weird message saying the pkg is corrupt or something, I don't remember the message but I'll past it here next time I'll try to install Visual studio.

Anyway if you want to have safe installing of Visual studio 2005 on your vista:

  1. Installation has some problems when some programs such as Virus scanners are running. Run your system configuration ( you can always find it on your system using HELP) , choose "selective statup" and untick all the options.
  2. Some corrupted files are sometimes left in temp, I don't know why but you need to remove them before installation. This should happen when you cancel an Installation, but I've seen it in the first attempt too. In the search text box above the start , type %temp%. Delete all the temporary files. Remember to make a copy of the things I think you might need.


 

Well that it. I hope this helps someone else too.

Wednesday, 21 November 2007

My First Post

Well this is my first post. Actually I'm trying to check how word 2007 publishes my post.

About me:

I'm a bit crazy although I'm trying to be more decent after 2 years of getting married. I guess My husband was pretty disappointed when he figured out I'm not a proper cook, not a proper house cleaner, not a proper money saver, and so on. That doesn't mean I'm a lazy stupid girl. It's just that I have more passion in discovering life, discovering new things and bouncing around that doing the same boring thing over and over again every day. I cook but I love to try new things any time I'm cooking which probably would never make a real cook, cause I barely try thing more to once, or maybe twice.

Well I've just started doing a PhD which I'm stuck in it now. I'll write about that in a new post later.