-2005-01-16 Jean-Pierre Roux <jpr@creatis.univ-lyon1.fr>
+2005-01-17 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * src/gdcmUtil.cxx : bug fix to find the Windows MAC address. Now, there
+ is no memory access violation
+ * gdcmPython/demo : add python demos using VTK
+
+2005-01-16 Jean-Pierre Roux <jpr@creatis.univ-lyon1.fr>
* FIX 'Dictionnary' is now spelt 'Dictionary'
'wether' is now spelt 'whether'
'archieve' is now spelt 'archive' ;-)
* ADD DicomDir, DicomDirPatient, DicomDirStudy, DicomDirSerie, DicomDirImage
related methods, in order not to expose internal mechanisms
InitTraversal();
- GetNextEntry();
+ GetNextEntry();
* REM methods that exposed internal mechanisms :
DicomDir::GetDicomDirPatients()
DicomDirPatient::GetDicomDirStudies()
SET(vtkgdcmPython_la_SOURCES
${GDCM_SOURCE_DIR}/vtk/vtkGdcmReader.cxx
+ ${GDCM_SOURCE_DIR}/vtk/vtkGdcmWriter.cxx
)
SET_SOURCE_FILES_PROPERTIES(vtkGdcmReaderPython.cxx GENERATED)
#-----------------------------------------------------------------------------
# DOH! python is not found by default
FIND_PROGRAM(PYTHON_EXECUTABLE
- NAMES python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
+ NAMES python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintDict.py.in
${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDict.py
)
+
+#-----------------------------------------------------------------------------
+# Same but for VTK
+IF(GDCM_VTK)
+ IF(PYTHON_EXECUTABLE)
+ ADD_TEST(Python-VTK-Reader ${PYTHON_EXECUTABLE}
+ ${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmReader.py
+ )
+ ADD_TEST(Python-VTK-Writer ${PYTHON_EXECUTABLE}
+ ${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmWriter.py
+ )
+ ENDIF(PYTHON_EXECUTABLE)
+
+ CONFIGURE_FILE(
+ ${GDCM_SOURCE_DIR}/gdcmPython/demo/vtkGdcmReader.py.in
+ ${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmReader.py
+ )
+
+ CONFIGURE_FILE(
+ ${GDCM_SOURCE_DIR}/gdcmPython/demo/vtkGdcmWriter.py.in
+ ${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmWriter.py
+ )
+ENDIF(GDCM_VTK)
--- /dev/null
+import sys
+import os
+
+# All paths must be added without system tests, because of ctest...
+sys.path.append('${GDCM_BINARY_DIR}')
+if os.name == 'posix':
+ sys.path.append('${GDCM_BINARY_DIR}/bin')
+else:
+ sys.path.append('${GDCM_BINARY_DIR}/bin/Release')
+ sys.path.append('${GDCM_BINARY_DIR}/bin/Debug')
+
+from gdcmPython.vtk import *
+from vtkpython import *
+
+# Get the file names
+try:
+ fileName = sys.argv[1]
+except IndexError:
+ fileName = os.path.join(GDCM_DATA_PATH, "test.acr")
+
+# read the image
+reader = vtkGdcmReader()
+reader.SetFileName(fileName)
+reader.Update()
+
+# show the image
+viewer = vtkImageViewer()
+viewer.SetInput(reader.GetOutput())
+rng = reader.GetOutput().GetScalarRange()
+viewer.SetColorWindow(rng[1] - rng[0])
+viewer.SetColorLevel(0.5 * (rng[1] + rng[0]))
+
+dim = reader.GetOutput().GetDimensions()
+viewer.SetSize(dim[0],dim[1])
+if(dim[2] != 1):
+ # For multifame dicom, take a snapshot of the center slice (+/- 1)
+ viewer.SetZSlice(dim[2] / 2)
+else:
+ viewer.SetZSlice(0)
+viewer.Render()
+
+# sys.stdin.read(1)
+
--- /dev/null
+import sys
+import os
+
+sys.path.append('${GDCM_BINARY_DIR}')
+if os.name == 'posix':
+ sys.path.append('${GDCM_BINARY_DIR}/bin')
+else:
+ sys.path.append('${GDCM_BINARY_DIR}/bin/Release')
+ sys.path.append('${GDCM_BINARY_DIR}/bin/Debug')
+
+from gdcmPython.vtk import *
+from vtkpython import *
+
+# Get the file names
+try:
+ fileName = sys.argv[1]
+except IndexError:
+ fileName = os.path.join(GDCM_DATA_PATH, "test.acr")
+
+# read the image
+reader = vtkGdcmReader()
+reader.SetFileName(fileName)
+
+# write the image
+writer = vtkGdcmWriter()
+writer.SetInput(reader.GetOutput())
+writer.SetFileName("outputPy.dcm")
+writer.Write()
+
+# re-read the image
+reader2 = vtkGdcmReader()
+reader2.SetFileName("outputPy.dcm")
+reader2.Update()
+
+# show the image
+viewer = vtkImageViewer()
+viewer.SetInput(reader2.GetOutput())
+rng = reader.GetOutput().GetScalarRange()
+viewer.SetColorWindow(rng[1] - rng[0])
+viewer.SetColorLevel(0.5 * (rng[1] + rng[0]))
+
+dim = reader.GetOutput().GetDimensions()
+viewer.SetSize(dim[0],dim[1])
+if(dim[2] != 1):
+ # For multifame dicom, take a snapshot of the center slice (+/- 1)
+ viewer.SetZSlice(dim[2] / 2)
+else:
+ viewer.SetZSlice(0)
+viewer.Render()
+
+# sys.stdin.read(1)
+
Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2005/01/17 13:55:26 $
- Version: $Revision: 1.100 $
+ Date: $Date: 2005/01/17 14:20:30 $
+ Version: $Revision: 1.101 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// For GetMACAddress
#ifdef _WIN32
-#include <snmp.h>
-#include <conio.h>
+ #include <snmp.h>
+ #include <conio.h>
#else
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/types.h>
#endif
// How do I do that in CMake ?
#ifdef __APPLE__
-#define HAVE_SA_LEN
-#define CMAKE_HAVE_NET_IF_DL_H
-#define CMAKE_HAVE_NETINET_IN_H
-#define CMAKE_HAVE_NET_IF_H
+ #define HAVE_SA_LEN
+ #define CMAKE_HAVE_NET_IF_DL_H
+ #define CMAKE_HAVE_NETINET_IN_H
+ #define CMAKE_HAVE_NET_IF_H
#endif //APPLE
#ifdef CMAKE_HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h> // For SIOCGIFCONF on Linux
+ #include <sys/ioctl.h> // For SIOCGIFCONF on Linux
#endif
#ifdef CMAKE_HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
+ #include <sys/socket.h>
#endif
#ifdef CMAKE_HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h> // For SIOCGIFCONF on SunOS
+ #include <sys/sockio.h> // For SIOCGIFCONF on SunOS
#endif
#ifdef CMAKE_HAVE_NET_IF_H
-#include <net/if.h>
+ #include <net/if.h>
#endif
#ifdef CMAKE_HAVE_NETINET_IN_H
-#include <netinet/in.h> //For IPPROTO_IP
+ #include <netinet/in.h> //For IPPROTO_IP
#endif
#ifdef CMAKE_HAVE_NET_IF_DL_H
-#include <net/if_dl.h>
+ #include <net/if_dl.h>
#endif
#ifdef __sun
-//#if defined(CMAKE_HAVE_NET_IF_ARP_H) && defined(__sun)
-// This is absolutely necesseray on SunOS
-#include <net/if_arp.h>
+ //#if defined(CMAKE_HAVE_NET_IF_ARP_H) && defined(__sun)
+ // This is absolutely necesseray on SunOS
+ #include <net/if_arp.h>
#endif
namespace gdcm
// Free the bindings
SNMP_FreeVarBind(&varBind[0]);
SNMP_FreeVarBind(&varBind[1]);
+
+
+
+/* IP_ADAPTER_INFO AdapterInfo[2];
+ DWORD dwBufSize = sizeof(AdapterInfo);
+
+ DWORD dwStatus = GetAdaptersInfo(AdapterInfo, &dwBufSize);
+
+ PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
+ do
+ {
+ unsigned char *MAC=pAdapterInfo->Address;
+ printf("Your MAC Address Is: %02X-%02X-%02X-%02X-%02X-%02X", MAC[0], MAC[1], MAC[2], MAC[3], MAC[4], MAC[5]);
+ pAdapterInfo = pAdapterInfo->Next;
+ }
+ while(pAdapterInfo); */
+
+
return 0;
#endif //Win32 version