[Insight-users] 64 Bit windows problem loading 2D images...

Luis Ibanez luis.ibanez at kitware.com
Mon Sep 20 17:15:44 EDT 2010


Hi Neil,

The first suspect to keep in mind is the fact that in Windows 64
the "long int" type is still 32-bits in size.

If you are making any assumptions about the size of "long int",
that may be part of the problem.

In order to find the source of the problem, you have to reduce
it to a minimal case. I would suggest that you first try just reading
the image without any GUI or Visualization, and then progressively
add those functionalities back until you see the error appearing.

You may also want to pay extra attention to any truncation warnings...


     Regards,


             Luis


-------------------------------------------------------------------------------
On Tue, Sep 14, 2010 at 11:40 PM, <Neil.Burdett at csiro.au> wrote:

>  Hi,
>
>     We have a product (written in C++) that runs on Linux and Windows (XP)
> 32 bit. I am currently trying to make it work on a 64 bit windows machine.
> The application can load a number of different types of medical image
> formats (i.e. Analyze, DiCOM etc) and displays the results on a WxWidget
> pane that has 4 quadrants (axial, sagittal, coronal and 3D view). The 3D
> view allows us to rotate the image, whereas the others are essentially 2D
> and allow us to move through the image slice by slice. A works okay on 32
> bit windows and Linux but on 64 bit windows (XP and Windows 7) the 3D view
> of the image is the only one that can be loaded, the other screens remain
> greyed out. So I’m just very confused by this...
>
>
>
> We are using :
>
>
>
> Visual Studio 9 2008
>
> ITK 3.20.0
>
> VTK 5.6.0
>
> WxWidgets 2.8.10
>
> SigC++ 2.2.3
>
> Glew 1.5.2
>
>
>
> The images are loaded using a number of different methods and classes, I’ll
> submit as much as I think is relevant:
>
> void milxImageLoaderTask::Run(void)
>
> {
>
>   milxImageLoader loader;
>
>   m_image = loader.Load(m_filename);
>
> }
>
>
>
> milxImage *milxImageLoader::Load( const wxString &filename ) const
>
> {
>
>   //milxImage::ComponentType compType;
>
>
>
>   milxImageSource source(filename);
>
>   milxImage3D *image = new milxImage3D();
>
>
>
>   try {
>
>     milxImageSource::ImageType::Pointer itkImage = source.GetOutput();
>
>     if( itkImage.IsNull() ) {
>
>       delete image;
>
>       //throw milx::Exception( FILE_READ_ERROR, "Error reading file '%s'",
> std::string(filename.mb_str()).c_str());
>
>       return 0;
>
>       }
>
>     image->SetImage3D( itkImage );
>
>     image->SetName(filename);
>
>     image->SetFileName(filename);
>
>     itkImage->Update();
>
>     } catch( std::exception & err ) {
>
>     delete image;
>
>     //milxErrorMacro(<< "Exception caught while reading !");
>
>     //milxErrorMacro(<< err.what());
>
>     // Output the error to the terminal
>
>     std::cerr << "milxImage *milxImageLoader: Exception caught while
> reading: " << err.what() << std::endl;
>
>     //throw milx::Exception( FILE_READ_ERROR, "Error reading file '%s':
> %s", std::string(filename.mb_str()).c_str() );
>
>     return 0;
>
>     }
>
>
>
>   if( image ) {
>
>     image->SetName(filename);
>
>     //image->SetComponentType(compType);
>
>     }
>
>   return image;
>
> }
>
>
>
> void milxImageLoaderTask::Finalize(bool complete)
>
> {
>
>   if( complete ) {
>
>     if( m_image == NULL ) {
>
>       // Read failed. Display a semi-useless error message for now until
>
>       // we can get some meaningful context.
>
>       wxMessageBox(_("Unable to load image file: '") + m_filename + _("'"),
> _("Error loading image"), wxOK|wxICON_ERROR);
>
>       } else {
>
>       milxImageDataMap * imageDataMap =
> milxViewController::GetInstance()->AddImage(m_image);
>
>       if( m_openPage ) {
>
>         milxViewController::GetInstance()->AddPage(imageDataMap);
>
>         }
>
>       }
>
>     }
>
> }
>
>
>
> Where milxImageDataMap is initialised too:
>
> void milxImageDataMap::Init( milxImage *image )
>
> {
>
>   PutImage(IMAGE_KEY_IMAGE, image);
>
>
>
>   // Get number of dimensions
>
>   int dimensions[3];
>
>   double spacing[3];
>
>   double origin[3];
>
>   image->GetVTKImageData()->GetSpacing(spacing);
>
>   image->GetVTKImageData()->GetOrigin(origin);
>
>   image->GetVTKImageData()->GetDimensions(dimensions);
>
>
>
>   PutFloat(IMAGE_KEY_VOXEL_SIZE_X, spacing[0]);
>
>   PutFloat(IMAGE_KEY_VOXEL_SIZE_Y, spacing[1]);
>
>   PutFloat(IMAGE_KEY_VOXEL_SIZE_Z, spacing[2]);
>
>
>
>   // Store the original image dimensions
>
>   PutInt(IMAGE_KEY_SIZE_X, dimensions[0]);
>
>   PutInt(IMAGE_KEY_SIZE_Y, dimensions[1]);
>
>   PutInt(IMAGE_KEY_SIZE_Z, dimensions[2]);
>
>
>
>   // Store the original vtk image data bounds (equiv to: dimensions *
> voxel size)
>
>   vtkFloatingPointType bounds[6];
>
>   image->GetVTKImageData()->GetBounds(bounds);
>
>   PutFloat(IMAGE_KEY_BOUNDS_MIN_X, bounds[0]);
>
>   PutFloat(IMAGE_KEY_BOUNDS_MAX_X, bounds[1]);
>
>   PutFloat(IMAGE_KEY_BOUNDS_MIN_Y, bounds[2]);
>
>   PutFloat(IMAGE_KEY_BOUNDS_MAX_Y, bounds[3]);
>
>   PutFloat(IMAGE_KEY_BOUNDS_MIN_Z, bounds[4]);
>
>   PutFloat(IMAGE_KEY_BOUNDS_MAX_Z, bounds[5]);
>
>
>
>   int midpos[3] = { dimensions[0]/2, dimensions[1]/2, dimensions[2]/2 };
>
>
>
>   PutInt(IMAGE_KEY_SLICE_X, midpos[0]);
>
>   PutInt(IMAGE_KEY_SLICE_Y, midpos[1]);
>
>   PutInt(IMAGE_KEY_SLICE_Z, midpos[2]);
>
>
>
>   // Extract default colour ranges etc
>
>   // TODO optimise this?
>
>   double intensityRange[2];
>
>   image->GetVTKImageData()->GetScalarRange(intensityRange);
>
>
>
>   PutFloat(IMAGE_KEY_INTENSITY_LOWER, intensityRange[0]);
>
>   PutFloat(IMAGE_KEY_INTENSITY_UPPER, intensityRange[1]);
>
>   PutInt(IMAGE_KEY_COLOUR_RAMP, VTK_RAMP_SCURVE);
>
>   PutVector4( IMAGE_KEY_COLOUR_LOWER, Vector4(0.0,0.0,0.0,1.0) );
>
>   PutVector4( IMAGE_KEY_COLOUR_UPPER, Vector4(1.0,1.0,1.0,1.0) );
>
>   PutInt(IMAGE_KEY_VOXEL_ACCURACY, 100);
>
>   PutInt(IMAGE_KEY_INTERPOLATION_MODE, -1);
>
>
>
>   // set some default mesh-related values
>
>   PutBool(MESH_KEY_COLOUR_BAR, false);
>
>   PutInt(MESH_KEY_SELECT, -1);
>
>   PutInt(MESH_KEY_SHADING, 1);
>
>
>
>   // Setup the derived data
>
> }
>
> vtkImageData *milxImageDataMap::GetVtkOutputData() const
>
> {
>
>   if( reslice == NULL ) {
>
>     return GetImage(IMAGE_KEY_IMAGE)->GetVTKImageData();
>
>     } else {
>
>     return reslice->GetOutput();
>
>     }
>
> }
>
>
>
> milxImage3D::Image3DType::Pointer milxImageDataMap::GetITKOutputData()
> const
>
> {
>
>   milxImage *image = GetImage(IMAGE_KEY_IMAGE);
>
>   vtkMatrix4x4 *inverse = GetVtkMatrix4x4(IMAGE_KEY_TRANSFORM_MATRIX);
>
>   milxImage3D *image3D = dynamic_cast<milxImage3D *>(image);
>
>   if( image3D != NULL ) {
>
>     vtkMatrix4x4 *matrix = vtkMatrix4x4::New();
>
>     vtkMatrix4x4::Invert(inverse, matrix);
>
>     typedef itk::ChangeInformationImageFilter<milxImage3D::Image3DType>
> InfoType;
>
>
>
>     InfoType::Pointer info = InfoType::New();
>
>     info->SetInput(image3D->GetImage3D());
>
>     InfoType::OutputImageDirectionType dir = info->GetOutputDirection();
>
>     for( int i=0; i<3; i++ ) {
>
>       for( int j=0; j<3; j++ ) {
>
>         dir(j,i) = matrix->GetElement(j,i);
>
>         }
>
>       }
>
>     info->SetOutputDirection(dir);
>
>     info->ChangeDirectionOn();
>
>     matrix->Delete();
>
>
>
>     const Vector3 &trans = GetVector3(IMAGE_KEY_TRANSLATE_VECTOR,
> Vector3(0,0,0));
>
>     milxImage3D::Image3DType::PointType sourceOrigin =
> image3D->GetImage3D()->GetOrigin();
>
>     double origin[3] = {sourceOrigin[0] + trans[0],
>
>     sourceOrigin[1] + trans[1],
>
>     sourceOrigin[2] + trans[2]};
>
>     info->SetOutputOrigin(origin);
>
>     info->ChangeOriginOn();
>
>     info->Update();
>
>     return info->GetOutput();
>
>     }
>
>   return NULL;
>
> }
>
>
>
> I was just wondering if anyone else had problems with 64 bit windows
> version (64 bit Linux works fine)
>
>
>
>
>
> Also, when I tried load a DICOM series I get an Output window shown, but
> the window is too small to display all the warning information. And when I
> try to pause the visual studio debugger the window always remains in the
> background and I’m unable to maximise it. Do these warnings get written
> somewhere? As all I can read at the moment is:
>
>
>
> WARNING in ..\..\..\InsightToolkit-3.20.0\Code\IO\itkGDCMImageIO.cxx line
>
> GDCMImageIO [000000000BC3AF40] the Dicom File (then I suspect the location
> of the dicom file)
>
>
>
> There are hundreds of these warnings scrolling down the list.
>
>
>
> Any help much appreciated as I’m not sure how to proceed
>
>
>
> Cheers
>
> Neil
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100920/e804c4ed/attachment.htm>


More information about the Insight-users mailing list