Hi there,<br>I changed the images pixel type , to unsigned long , and almost solved the problem. Now in the first image pair the output image has values from 0-1318 and in the second image pair from 0-360, although it is not exactly the same.<br>
I had problem though in registering the images (through imageregistration8.cxx), because it didnt performed the right scaling correction.<br>Any help in that?<br>Thanks,<br>Giorgos<br><br><div class="gmail_quote">On Wed, Apr 2, 2008 at 1:40 PM, Giorgos Pichis <<a href="mailto:gpichis@gmail.com">gpichis@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Hi there,<br>I tried to solve the problem using RescaleIntensityImageFilter but it didnt fix the problem.<br>
The input image has greylevel values from 0-1362 and the output image from 0-220.<br>In another example input image had values from 0-376 and the output from 0-241. <br>
it seems that the writer by default writes the images in the scale 0-255, but rescaling to 0-512 or 0-1024 didnt fix the problem<br><br>Thanks , <br><font color="#888888">Giorgos</font><div><div></div><div class="Wj3C7c">
<br><br><div class="gmail_quote">On Tue, Apr 1, 2008 at 11:48 AM, Oliver Trebbe <<a href="mailto:otrebbe@uni-muenster.de" target="_blank">otrebbe@uni-muenster.de</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi there,<br>
I think i also have the same Problem.<br>
After filtering and resampling my greylevel scale reached form ~ -30000 to ~+30000.<br>
Im also a little bit confused (tried to change the input pixel types, but that didnt work:))<br>
But i also use the RescaleIntensityImageFilter.<br>
Maybe this can help solving the problem.<br>
<br>
Greatings<br>
Oliver<br>
<br>
<br>
Giorgos Pichis schrieb:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div>
Hi Luis,<br>
Here is the code I used. It is the example ResampleImageFilter5 with a change in the transform.<br>
The images were dicom mammography 3d images.<br>
The same problem appeared when I used .vtk 3d images . I didnt changed<br>
the input and output pixel type<br>
<br>
Thanks ,<br>
Giorgos<br>
<br>
<br>
#include "itkImage.h"<br>
#include "itkImageFileReader.h"<br>
#include "itkImageFileWriter.h"<br>
#include "itkResampleImageFilter.h"<br>
#include "itkLinearInterpolateImageFunction.h"<br>
#include "itkSimilarity3DTransform.h"<br>
<br>
int main( int argc, char * argv[] )<br>
{<br>
  if( argc < 5 )<br>
    {<br>
    std::cerr << "Usage: " << std::endl;<br>
    std::cerr << argv[0] << "  inputImageFile  outputImageFile  degrees  scale" << std::endl;<br>
    return EXIT_FAILURE;<br>
    }<br>
<br>
  const     unsigned int   Dimension = 3;<br>
  typedef   unsigned char  InputPixelType;<br>
  typedef   unsigned char  OutputPixelType;<br>
<br>
  typedef itk::Image< InputPixelType,  Dimension >   InputImageType;<br>
  typedef itk::Image< OutputPixelType, Dimension >   OutputImageType;<br>
<br>
  typedef itk::ImageFileReader< InputImageType  >  ReaderType;<br>
  typedef itk::ImageFileWriter< OutputImageType >  WriterType;<br>
<br>
  ReaderType::Pointer reader = ReaderType::New();<br>
  WriterType::Pointer writer = WriterType::New();<br>
<br>
  reader->SetFileName( argv[1] );<br>
  writer->SetFileName( argv[2] );<br>
    typedef itk::Similarity3DTransform< double >  TransformType;<br>
  TransformType::Pointer transform = TransformType::New();<br>
<br>
  typedef TransformType::ParametersType ParametersType;<br>
  ParametersType parameters;<br>
   double angleInDegrees = atof( argv[3] );<br>
    double scale          = atof( argv[4] );<br>
     transform->SetScale(scale);<br>
  typedef itk::ResampleImageFilter<<br>
                  InputImageType, OutputImageType >  FilterType;<br>
<br>
  FilterType::Pointer filter = FilterType::New();<br>
<br>
<br>
  typedef itk::LinearInterpolateImageFunction<<br>
                       InputImageType, double >  InterpolatorType;<br>
  InterpolatorType::Pointer interpolator = InterpolatorType::New();<br>
   filter->SetInterpolator( interpolator );<br>
<br>
  filter->SetDefaultPixelValue( 0 );<br>
<br>
  reader->Update();<br>
  const InputImageType::SpacingType&<br>
    spacing = reader->GetOutput()->GetSpacing();<br>
  const InputImageType::PointType&<br>
    origin  = reader->GetOutput()->GetOrigin();<br>
  InputImageType::SizeType size =<br>
      reader->GetOutput()->GetLargestPossibleRegion().GetSize();<br>
<br>
  filter->SetOutputOrigin( origin );<br>
  filter->SetOutputSpacing( spacing );<br>
  filter->SetSize( size );<br>
<br>
<br>
  filter->SetInput( reader->GetOutput() );<br>
  writer->SetInput( filter->GetOutput() );<br>
  TransformType::InputPointType rotationCenter;<br>
  rotationCenter[0] = origin[0] + spacing[0] * size[0] / 2.0;<br>
  rotationCenter[1] = origin[1] + spacing[1] * size[1] / 2.0;<br>
  rotationCenter[2] = origin[2] + spacing[2] * size[2] / 2.0;<br>
  transform->SetCenter( rotationCenter );<br>
<br>
  typedef TransformType::VersorType VersorType;<br>
  typedef VersorType::VectorType VectorType;<br>
  VersorType rotation;<br>
  VectorType axis;<br>
  axis[0]=0.0;<br>
  axis[1]=0.0;<br>
  axis[2]=1.0;<br>
   double degreesToRadians = atan(1.0) / 45.0;<br>
    const double angle = angleInDegrees * degreesToRadians;<br>
 rotation.Set (axis, angle);<br>
  transform->SetRotation( rotation );<br>
   TransformType::OutputVectorType translation;<br>
<br>
  translation[0] =   0.0;<br>
  translation[1] =   0.0;<br>
  translation[2] =   0.0;<br>
  transform->SetTranslation (translation);<br>
 <br>
  filter->SetTransform( transform );<br>
<br>
  try<br>
    {<br>
    writer->Update();<br>
    }<br>
  catch( itk::ExceptionObject & excep )<br>
    {<br>
    std::cerr << "Exception catched !" << std::endl;<br>
    std::cerr << excep << std::endl;<br>
    }<br>
  return EXIT_SUCCESS;<br>
}<br>
<br>
<br></div></div><div>
On Fri, Mar 28, 2008 at 6:18 PM, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a> <mailto:<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>>> wrote:<br>
<br>
    Hi Giorgos,<br>
<br>
    1) How different are the intensities of the output image ?<br>
<br>
    2) What Transform are you using ?<br>
<br>
    3) What interpolator are you using ?<br>
<br>
    4) What image type did you defined for the input ?<br>
<br>
    5) What image type did you defined for the output ?<br>
<br>
    6) What is the modality of the input image ?<br>
<br>
    ...<br>
<br>
    7) Please post your code to the list.<br>
<br>
<br>
      Thanks<br>
<br>
<br>
         Luis<br>
<br>
<br>
    -----------------------<br>
    Giorgos Pichis wrote:<br>
    > Hi there,<br>
    > I tried to resample a 3d image (.vtk) with a transformation,<br>
    > but the output image (  writer->SetInput(filter->GetOutput() );   )<br>
    > had different intensity values than the input image.<br>
    > Do you know what might be the problem?<br>
    > Thanks<br>
    ><br>
    ><br>
    ><br>
    ------------------------------------------------------------------------<br>
    ><br>
    > _______________________________________________<br>
    > Insight-users mailing list<br></div>
    > <a href="mailto:Insight-users@itk.org" target="_blank">Insight-users@itk.org</a> <mailto:<a href="mailto:Insight-users@itk.org" target="_blank">Insight-users@itk.org</a>><div><br>
    > <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Insight-users mailing list<br>
<a href="mailto:Insight-users@itk.org" target="_blank">Insight-users@itk.org</a><br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
  <br>
</div></blockquote>
<br>
</blockquote></div><br>
</div></div></blockquote></div><br>