/*========================================================================= Program: FusionViewer Module: $RCSfile: ItkImageProvider.h,v $ Language: C++ Date: $Date: 2008/01/11 20:28:20 $ Version: $Revision: 1.2 $ Copyright (c) Insightful Corporation. All rights reserved. See Copyright.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #ifndef _Included_ItkImageProvider #define _Included_ItkImageProvider #include #include class ImageProvider; class ItkIOException; // Function attribute macros for the Windows DLL build // ITK_IMAGE_PROVIDER_EXPORT should be defined when building the DLL. // NO_ITK_IMAGE_PROVIDER_DLL should be defined when a DLL is not being built. #if (defined(NO_ITK_IMAGE_PROVIDER_DLL) || !defined(WIN32)) #define IMAGE_PROVIDER #else #ifdef ITK_IMAGE_PROVIDER_EXPORT #define IMAGE_PROVIDER __declspec(dllexport) #else #define IMAGE_PROVIDER __declspec(dllimport) #endif #endif /**\namespace ItkImageProvider *\addtogroup FusionViewerJNI *\brief Loads and saves images using ITK's image IO classes. * All functions throw ItkIOException on I/O errors. */ namespace ItkImageProvider { /**\class Open2DFile * \brief Load the image at path filename. * * If pixelType is not NULL, the image is read as pixelType * (e.g., &typeid(unsigned char)). Otherwise, the image is read as its native pixel type * in the file. */ IMAGE_PROVIDER ImageProvider *OpenFile(const char *filename, const std::type_info *pixelType = NULL); /**\class Open2DDICOMFile * \brief Load the image at path filename. * * If pixelType is not NULL, the image is read as pixelType * (e.g., &typeid(unsigned char)). Otherwise, the image is read as its native pixel type * in the file. */ IMAGE_PROVIDER ImageProvider *OpenDICOMFile(const char *path, const char *seriesId, const std::type_info *pixelType = NULL); /**\class Open3DVolume * \brief Load the images at filenames as a 3D volume. * * If pixelType is not NULL, the image is read as pixelType. * Otherwise, the image is read as its native pixel type in the file. */ IMAGE_PROVIDER ImageProvider *OpenFile(const std::vector< std::string >& filenames, const std::type_info *pixelType = NULL); /**\class CreateImage * \brief Create an ImageProvider from a memory buffer, copying the image pixels given. * * @param size array of length 3 that containing the x, y, and z dimensions of the image * @param pixelSpacing array of length 3 containing the spacing between pixel centers along the x, y, and z axes * @param pixelType type of pixels (e.g., &typeid(unsigned char)) * @param pixels buffer containing the image pixels to be copied into the new ImageProvider */ IMAGE_PROVIDER ImageProvider *CreateImage(int *size, float *pixelSpacing, const std::type_info& pixelType, void *pixels); /**\class SaveIamge * \brief Saves pImage to file filename. * * pImage must have been created by an ItkImageProvider function. */ IMAGE_PROVIDER void SaveImage(const char *filename, ImageProvider *pImage); } #endif