[Insight-users] Istropic resampled CT image got fipped at y direction, and out of range

Luis Ibanez luis.ibanez at kitware.com
Fri Feb 20 12:41:59 EST 2009


Hi Baoyun,


     Congratulations !

     You just found a bug in the ITK Example.



The Example is missing to call the method

        SetOutputDirection()

a fix has been committed to CVS
http://www.itk.org/cgi-bin/viewcvs.cgi/Examples/Filtering/ResampleVolumesToBeIsotropic.cxx?root=Insight&r1=1.21&r2=1.22&sortby=date

Simply try adding the line:

    resampler->SetOutputDirection( inputImage->GetDirection() );


just after:

    resampler->SetOutputOrigin( inputImage->GetOrigin() );


Without this line, the filter is setting the direction of the
output image to be an identity matrix (direction cosines),
while, most likely, your in put image has a different type
of direction.

You can always verify this by adding a print out:


     std::cout << inputImage->GetDirection() << std::endl


--


Please let us know if you still see any problem,


    Thanks


       Luis


-------------------
Baoyun Li wrote:
> Dear All:
> This is regarding to yesterday's email, resampled image got out of range 
> values for all voxel.
> I am trying to resice the CT data to Isotropic, and the program I am 
> using is ResampleVolumesToBeIsotropic.cxx for the ITK filter example.
>  
> Now I  remove this :
> resampler->SetOutputOrigin( inputImage->GetOrigin() );
>  and reader: origin1=inputImage->GetOrigin(),
>  the value for origin1 are all [0 0 0];
>  
> 1 if we set origin2=[0 0 0] and  resampler->SetOutputOrigin(origin2),
>  
> I got all zeros value on the output image.
>  
> 2 if I set origin2=[0 -300 0], we saw most part of the CT image, but the 
> image is fippled at top down direction from MRICro.
>  
> my input and out put are all hdr file, I tried nii data and have the 
> same problem
>  
> Can somebody tell me how to solve the problem?
>  
> Baoyun
> 
> ------------------------------------------------------------------------
> *From:* Baoyun Li <baoyun_li123 at yahoo.com>
> *To:* Luis Ibanez <luis.ibanez at kitware.com>
> *Cc:* insight-users at itk.org
> *Sent:* Thursday, February 19, 2009 4:53:30 PM
> *Subject:* error when resampling the CT data to Isotropic
> 
> 
> Dear All:
>  
> I am trying to resice the CT data to Isotropic, and the program I am 
> using is ResampleVolumesToBeIsotropic.cxx for the ITK filter example.
>  
>  
> My input data is called SE1.hdr
> the space resolution is 0.7*0.7*2.5.
>  
> After I run the program, I got the output.hdr. The number of voxels and 
> the spacing of the output are correct after I check the result at 
> MRICro. But all the voxel has the default outside value. Seems after the 
> indentity transform, all the voxels are out of range.
>  
> Also I output  the SmootherY results, it is ok.
>  
> Can any body let me know what happend? How to check the value of transform.
>  
> /////////////////////////////changes I made on the code
> typedef   short  InputPixelType;
>  
> intensityWindowing->SetOutputMinimum(   0.0 );
>   intensityWindowing->SetOutputMaximum( 1200.0 ); // floats but in the 
> range of chars.
> typedef   short   OutputPixelType;
>  
> and some writers to record the interval output.
>  
>  
> ////////////////////////
>  
> I also checked the results using NII as input and output, the resliced 
> image contains all background value. I doubt the problem happend at the
>  
>  typedef itk::IdentityTransform< double, Dimension >  TransformType;
>   TransformType::Pointer transform = TransformType::New();
>   transform->SetIdentity();
>   resampler->SetTransform( transform );
>  
> Can somebody help me to figure out this problem??
>  
>  
> Thanks
>  
> Baoyun
> 
> 


More information about the Insight-users mailing list