Picon
Picon

Using a transform


Dear all,

I have a remaining problem with applying a tranform on an image. I would like to use the transform result of my
registration program to apply on the moving image and write this image into a file. When i do it i have an
empty image. Could somebody help me to solve this problem? Thanks a lot,

Regards,

Josiane.
John | 1 Oct 2008 12:15
Picon
Favicon

Re: problem with RGB .bmp images

Luis Ibanez <luis.ibanez <at> ...> writes:

> 
> 
> Hi John,
> 
> Are you declaring your image as an image whose
> pixel type is itkRGBPixel<>  ?
> 
> Please provide a minimal code snippet illustrating your problem.
> 
>     Thanks
> 
>        Luis

Hi Luis,

Of course I declared the pixel type as itk::RGBPixel.

To verify that it is not an error of my code I took the example from
Examples/DataRepresentation/Image/RGBImage.cxx.

The following code results for the image http://jperl.gu6.info/000.bmp
in the output:

Pixel values from GetRed,GetGreen,GetBlue:
Red = 137
Green = 137
Blue = 137
Pixel values:
(Continue reading)

John | 1 Oct 2008 12:21
Picon
Favicon

Re: ChangeInformationImage filter and ImageFileWriter input problem

Benhacene Boudan Mustafa <m.benhacene.boudan <at> ...> writes:

> 
> 
> Hi all, 
> i have to transform a dose map with a computed deformation field. The dose map
exported from the clinical
> software (eclipse) only gives the x and y spacing (don't ask me why for the
love of god) so i have to force the z
> spacing in my algorithm. For that i am using the ChangeInformationImage
filter. But when i try to use the
> outputfilter as the input of my ImageFileWriter filter : 
> 
> 	   writer->SetInput( filter->GetOutput() );
> 
> i have an error during the compilation: 
> 
> 	erreur: «filter» was not declared in this scope
> 
> Any idea why ?
> 
> Thank you very much.
> 
> karim

Hi karim,

did you include the header file of ChangeInformationImageFilter? Sounds like you
didn't do.

(Continue reading)

Hua-Mei Chen | 1 Oct 2008 13:01
Picon

Re: How to re-use an itk ImageFileReader?

Hi,

  I used the following code to read image data. However, my program had an 
error message "Access violation reading location 0xfeeefefe." the second 
time m_ImageFileReader->Delete( ) was invoked. Can anyone tell what goes 
wrong in my code? Thank you.

while (continue){

if (m_ImageFileReader != (void*) 0) m_ImageFileReader->Delete( );
m_ImageFileReader = ImageFileReaderType::New();
m_ImageFileReader->SetFileName( m_InputFileName);
m_InputImage = m_imageFileReader->GetOutput();
m_ImageFileReader->Update();
...
...
}

Chen

----- Original Message ----- 
From: "Hua-Mei Chen" <huameichen0523@...>
To: "ITK Users" <insight-users@...>
Sent: Tuesday, September 30, 2008 10:14 AM
Subject: How to re-use an itk ImageFileReader?

> Hi,
>
>   I am trying to re-use an itk ImageFileReader to read the same type of 
> images. However, it crashes the second time the Update( ) method is 
(Continue reading)

Luis Ibanez | 1 Oct 2008 14:51
Favicon
Gravatar

Chris DiBona (Google) will speak about Open Source at RPI on Monday, October 6 at 5:30pm in JEC 311


Chris DiBona from Google will speak at RPI on Monday, October 6 at
5:30pm in JEC 3117 at Rensselaer Polytechnic Institute.

This presentation is in support of the "Open Source Software Practice"
course. The presentation is open to the public.

Mr. DiBona will speak about open source efforts at Google, and what
Google is doing to support open source. An extensive Q&A session will
complete the presentation.

BIO
===
Chris DiBona is the open source programs manager at Mountain View, Ca.
based Google where his team oversees license compliance and supports the
open source developer community through programs such as the Google
Summer of Code and through the release of open source software projects
and patches.

Mr. DiBona is an internationally known advocate of open source software
and related methodologies. He occasionally appears on the This Week in
Tech and Cranky Geeks podcasts. He is a visiting scholar at the MIT
Sloan School of Management and has a masters in software engineering
from Carnegie Mellon University. Additionally, he serves on the advisory
board of imeem, a San Francisco, Ca. based social networking firm.

Before joining Google, Mr. DiBona was an editor and author for the
website Slashdot.org . Additionally, he coedited the award-winning essay
compilations "Open Sources" and "Open Sources 2.0" and writes for
several publications. He was the host of Floss Weekly with Leo Laporte
(Continue reading)

Luis Ibanez | 1 Oct 2008 15:43
Favicon
Gravatar

Re: Using a transform


Hi Josiane,

a) How do you arrive to the conclusion that the image is empty ?

    by using a viewer  ?
   (if so, please let us know what viewer you are using)

b) Is this a PNG image of 16 bits ?

You will find many examples of resampling a moving image using
the transform resulting from a Registration, in the directory

    Insight/Examples/Registration

a common mistake is to save PNG images in 16 bits that only
contain data in the first 8 bits. Most viewers do not rescale
the intensities and then the images look empty.

Another common mistake is forgetting to initialize properly
the ResampleImageFilter parameters for:

   * OutputOrigin
   * OutputDirection
   * OutputSpacing

Please let us know about the questions above.

    Thanks

(Continue reading)

Luis Ibanez | 1 Oct 2008 15:46
Favicon
Gravatar

Re: How to re-use an itk ImageFileReader?


Hi Hua-Mei,

   You should *never* call "Delete()" in an ITK class   :-)

SmartPointers take care of the destruction of objects in ITK.

If what you want to do is to reuse the ImageFileReader, you simply
need to disconnect the first output image before you read a new one.

For example

     reader->SetFileName("image1.mhd");
     reader->Update();
     ImageType::ConstPointer image1 = reader->GetOutput();
     image1->DisconnectPipeline();

     reader->SetFileName("image2.mhd");
     reader->Update();
     ImageType::ConstPointer image2 = reader->GetOutput();
     image2->DisconnectPipeline();

Then you can use "image1" and "image2".

   Regards,

       Luis

------------------
Hua-Mei Chen wrote:
(Continue reading)

alexandre govignon | 1 Oct 2008 17:30
Picon

Zero-padding

Hi all,
i have implemented a code for zero-padding that worked well for float,
and generally speaking for dicom formats.
But it doesn't work that well since i use int pixel type in a raw image...
The problem is that the image is not copy in one block in the top left
corner... But it is shared at different part of the image. It never
happens when i used dicom formats...

Have you an idea?

The code of my function is:

void CDose::Padder3D(string Path1,string PathInter)
{	
		
	typedef int Pix;
	typedef itk::Image< Pix, 3 > ImageTy;
	typedef itk::ImageFileReader< ImageTy > ReaderTy;
	typedef itk::ImageFileWriter< ImageTy > WriterTy;
	ImageTy::Pointer inputImage;
	ReaderTy::Pointer reader = ReaderTy::New();
	reader->SetFileName( Path1);
	try
	{
		reader->Update();
		inputImage = reader->GetOutput();
		
	}
	catch ( itk::ExceptionObject &err)
	{
(Continue reading)

frédéric salvador | 1 Oct 2008 17:40
Picon

Fltk UI with Axial, Sagittal and Coronal views

Dear all,

I have created a fltk UI that allows to load (itk::VolumeImageReader,...) and display .mha images in a window through the Axial view.
I would like to add 2 windows in my UI to display the Sagittal and Coronal views.
What is the best way to do this?
Does it exist kind of an "orientation()" function so as to do this easily?
Thnak you very much in advance for your response.

Best regards.

Frederic
_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
Hua-Mei Chen | 1 Oct 2008 18:02
Picon

Re: How to re-use an itk ImageFileReader?

Luis,
   Thank you so much. I knew I should not call Delete( ) in ITK, but I could 
not think of any other way to do it and did not get any help sooner, so I 
gave it a try. :)
   May I know where is the DisconnectPipeline( ) method introduced in the 
software guide? It is exactly what I need.
   By the way, why is it o.k. to call Delete( ) in many VTK classes like 
vtkRenderer, vtkActor, ... Are the design principles different?

Regards,

Hua-mei

----- Original Message ----- 
From: "Luis Ibanez" <luis.ibanez@...>
To: "Hua-Mei Chen" <huameichen0523@...>
Cc: "ITK Users" <insight-users@...>
Sent: Wednesday, October 01, 2008 8:46 AM
Subject: Re: [Insight-users] How to re-use an itk ImageFileReader?

>
> Hi Hua-Mei,
>
>   You should *never* call "Delete()" in an ITK class   :-)
>
> SmartPointers take care of the destruction of objects in ITK.
>
> If what you want to do is to reuse the ImageFileReader, you simply
> need to disconnect the first output image before you read a new one.
>
> For example
>
>
>     reader->SetFileName("image1.mhd");
>     reader->Update();
>     ImageType::ConstPointer image1 = reader->GetOutput();
>     image1->DisconnectPipeline();
>
>     reader->SetFileName("image2.mhd");
>     reader->Update();
>     ImageType::ConstPointer image2 = reader->GetOutput();
>     image2->DisconnectPipeline();
>
>
> Then you can use "image1" and "image2".
>
>
>   Regards,
>
>
>       Luis
>
> ------------------
> Hua-Mei Chen wrote:
>> Hi,
>>
>>  I used the following code to read image data. However, my program had an 
>> error message "Access violation reading location 0xfeeefefe." the second 
>> time m_ImageFileReader->Delete( ) was invoked. Can anyone tell what goes 
>> wrong in my code? Thank you.
>>
>> while (continue){
>>
>> if (m_ImageFileReader != (void*) 0) m_ImageFileReader->Delete( );
>> m_ImageFileReader = ImageFileReaderType::New();
>> m_ImageFileReader->SetFileName( m_InputFileName);
>> m_InputImage = m_imageFileReader->GetOutput();
>> m_ImageFileReader->Update();
>> ...
>> ...
>> }
>>
>> Chen
>>
>>
>> ----- Original Message ----- From: "Hua-Mei Chen" 
>> <huameichen0523@...>
>> To: "ITK Users" <insight-users@...>
>> Sent: Tuesday, September 30, 2008 10:14 AM
>> Subject: How to re-use an itk ImageFileReader?
>>
>>
>>> Hi,
>>>
>>>   I am trying to re-use an itk ImageFileReader to read the same type of 
>>> images. However, it crashes the second time the Update( ) method is 
>>> involked. Do I need to New an itkImageFileReader each time I need one? 
>>> Is it possible to manually delete an existing itkImageFileReader before 
>>> I New another one? Please help. Thank you.
>>>
>>> Chen
>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users@...
>> http://www.itk.org/mailman/listinfo/insight-users
>> 

Gmane