PROJECT(GDCM)
CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
-#MESSAGE("MATHIEU: ${CMAKE_VERSION_RELEASE}")
-#MESSAGE("MATHIEU: ${CMAKE_VERSION}")
-#MESSAGE("MATHIEU: ${CMAKE_CACHE_RELEASE_VERSION}")
-#IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 2.0)
-# IF(${CMAKE_CACHE_RELEASE_VERSION} EQUAL "patch 5")
-# MESSAGE("MAHTIEU FOO")
-# ENDIF(${CMAKE_CACHE_RELEASE_VERSION} EQUAL "patch 5")
-#ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 2.0)
-
-
#-----------------------------------------------------------------------------
# GDCM version number, usefull for packaging and doxygen doc:
SET(GDCM_MAJOR_VERSION 0)
CHECK_INCLUDE_FILE_CONCAT("net/if_dl.h" CMAKE_HAVE_NET_IF_DL_H)
CHECK_INCLUDE_FILE_CONCAT("net/if_arp.h" CMAKE_HAVE_NET_IF_ARP_H)
+#-----------------------------------------------------------------------------
+# Force Big Endian emulation on little endian:
+OPTION(GDCM_FORCE_BIGENDIAN_EMULATION "Force Big Endian Emulation." OFF)
+
CONFIGURE_FILE(${GDCM_SOURCE_DIR}/gdcmConfigure.h.in
${GDCM_BINARY_DIR}/gdcmConfigure.h @ONLY IMMEDIATE)
#cmakedefine CMAKE_HAVE_NET_IF_ARP_H
#cmakedefine HAVE_SA_LEN
+#cmakedefine GDCM_FORCE_BIGENDIAN_EMULATION
/*--------------------------------------------------------------------------*/
/* GDCM Versioning */
Program: gdcm
Module: $RCSfile: gdcmBinEntry.cxx,v $
Language: C++
- Date: $Date: 2005/02/11 19:00:39 $
- Version: $Revision: 1.70 $
+ Date: $Date: 2005/02/11 20:04:07 $
+ Version: $Revision: 1.71 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// to write image with Big Endian Transfert Syntax,
/// and we are working on Little Endian Processor
-#ifdef GDCM_WORDS_BIGENDIAN
+#if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
/// \todo FIXME Right now, we only care of Pixels element
/// we should deal with *all* the BinEntries
/// well not really since we are not interpreting values read...
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/02/11 19:19:05 $
- Version: $Revision: 1.228 $
+ Date: $Date: 2005/02/11 20:04:08 $
+ Version: $Revision: 1.229 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <iomanip>
#include <fstream>
-// For nthos:
-#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)
- #include <winsock.h>
-#endif
-
-#ifdef CMAKE_HAVE_NETINET_IN_H
- #include <netinet/in.h>
-#endif
-
namespace gdcm
{
//-----------------------------------------------------------------------------
// First, compare HostByteOrder and NetworkByteOrder in order to
// determine if we shall need to swap bytes (i.e. the Endian type).
-
- uint32_t x = 4; // x : for ntohs
- bool net2host = (x == ntohs(x));// true when HostByteOrder is the same as NetworkByteOrder
+ bool net2host = Util::IsCurrentProcessorBigEndian();
// The easiest case is the one of a 'true' DICOM header, we just have
// to look for the string "DICM" inside the file preamble.
Program: gdcm
Module: $RCSfile: gdcmJpeg.cxx,v $
Language: C++
- Date: $Date: 2005/02/11 19:00:39 $
- Version: $Revision: 1.47 $
+ Date: $Date: 2005/02/11 20:04:08 $
+ Version: $Revision: 1.48 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
return true;
}
// The ijg has no notion of big endian, therefore always swap the jpeg stream
-#if defined(GDCM_WORDS_BIGENDIAN) && (CMAKE_BITS_IN_JSAMPLE != 8)
+#if (defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)) && (CMAKE_BITS_IN_JSAMPLE != 8)
uint16_t *buffer16 = (uint16_t*)*buffer;
uint16_t *pimage16 = (uint16_t*)pImage;
for(unsigned int i=0;i<rowsize/2;i++)
Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2005/02/11 19:12:40 $
- Version: $Revision: 1.137 $
+ Date: $Date: 2005/02/11 20:04:08 $
+ Version: $Revision: 1.138 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
bool Util::IsCurrentProcessorBigEndian()
{
-#ifdef GDCM_WORDS_BIGENDIAN
+#if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
return true;
#else
return false;
}
//-------------------------------------------------------------------------
-/**
- * \brief class for binary write
- * @param os ostream to write to
- * @param val val
- */
-template <class T>
-std::ostream &binary_write(std::ostream &os, const T &val)
-{
- return os.write(reinterpret_cast<const char*>(&val), sizeof val);
-}
-
/**
* \brief binary_write binary_write
* @param os ostream to write to
*/
std::ostream &binary_write(std::ostream &os, const uint16_t &val)
{
-#ifdef GDCM_WORDS_BIGENDIAN
+#if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
uint16_t swap;
swap = ((( val << 8 ) & 0xff00 ) | (( val >> 8 ) & 0x00ff ) );
return os.write(reinterpret_cast<const char*>(&swap), 2);
*/
std::ostream &binary_write(std::ostream &os, const uint32_t &val)
{
-#ifdef GDCM_WORDS_BIGENDIAN
+#if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
uint32_t swap;
swap = ( ((val<<24) & 0xff000000) | ((val<<8) & 0x00ff0000) |
((val>>8) & 0x0000ff00) | ((val>>24) & 0x000000ff) );
// This is tricky since we are writting two bytes buffer. Be carefull with little endian
// vs big endian. Also this other trick is to allocate a small (efficient) buffer that store
// intermidiate result before writting it.
-#ifdef GDCM_WORDS_BIGENDIAN
+#if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
const int BUFFER_SIZE = 4096;
uint16_t *buffer = new uint16_t[BUFFER_SIZE/2];
uint16_t *binArea16 = (uint16_t*)val;
Program: gdcm
Module: $RCSfile: gdcmUtil.h,v $
Language: C++
- Date: $Date: 2005/02/11 19:00:39 $
- Version: $Revision: 1.54 $
+ Date: $Date: 2005/02/11 20:04:08 $
+ Version: $Revision: 1.55 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
static const std::string GDCM_UID;
};
-template <class T>
-GDCM_EXPORT std::ostream &binary_write(std::ostream &os, const T &val);
GDCM_EXPORT std::ostream &binary_write(std::ostream &os, const uint16_t &val);
GDCM_EXPORT std::ostream &binary_write(std::ostream &os, const uint32_t &val);
GDCM_EXPORT std::ostream &binary_write(std::ostream &os, const char *val);