[Gdcm-hackers] gdcm-git:Grassroots DICOM branch master updated. 69bba8110ce32bf61b987c0388a81278bb2
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: Mathieu M. <ma...@us...> - 2011-01-27 10:19:40
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Grassroots DICOM".
The branch, master has been updated
via 69bba8110ce32bf61b987c0388a81278bb23ba94 (commit)
via 97686bde99dfb7331ccd8a0404aadb87adb997a1 (commit)
via 2d2ec3230f5c55d8ee50a76a58c10b264c166323 (commit)
via 609adecd89c8db66f7178d316ba031abf40315a1 (commit)
via c0f64ab685975ea5ff821e423018154fc066d29b (commit)
from b9151071cd2efdf9bb03344b832311cb43f2c038 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=69bba8110ce32bf61b987c0388a81278bb23ba94
commit 69bba8110ce32bf61b987c0388a81278bb23ba94
Author: Mathieu Malaterre <mat...@gm...>
Date: Thu Jan 27 11:19:07 2011 +0100
Start working on unenhance mechanism
diff --git a/Applications/Cxx/gdcmtar.cxx b/Applications/Cxx/gdcmtar.cxx
index e1d94a4..270ec76 100644
--- a/Applications/Cxx/gdcmtar.cxx
+++ b/Applications/Cxx/gdcmtar.cxx
@@ -874,8 +874,6 @@ int main (int argc, char *argv[])
}
else if ( unenhance )
{
- std::cerr << "Not implemented" << std::endl;
- return 1;
gdcm::ImageReader reader;
reader.SetFileName( filename.c_str() );
if( !reader.Read() )
@@ -884,8 +882,8 @@ int main (int argc, char *argv[])
return 1;
}
- const gdcm::File &file = reader.GetFile();
- const gdcm::DataSet &ds = file.GetDataSet();
+ gdcm::File &file = reader.GetFile();
+ gdcm::DataSet &ds = file.GetDataSet();
gdcm::MediaStorage ms;
ms.SetFromFile(file);
if( ms.IsUndefined() )
@@ -903,9 +901,21 @@ int main (int argc, char *argv[])
return 1;
}
+ // Ok then change it old Old MR Image Storage
+ gdcm::DataElement de( gdcm::Tag(0x0008, 0x0016) );
+ ms = gdcm::MediaStorage::MRImageStorage;
+ const char* msstr = gdcm::MediaStorage::GetMSString(ms);
+ de.SetByteValue( msstr, strlen(msstr) );
+ de.SetVR( gdcm::Attribute<0x0008, 0x0016>::GetVR() );
+ ds.Replace( de );
+ // Remove SharedFunctionalGroupsSequence
+ ds.Remove( gdcm::Tag( 0x5200,0x9229 ) );
+ // Remove PerFrameFunctionalGroupsSequence
+ ds.Remove( gdcm::Tag( 0x5200,0x9230 ) );
+
const gdcm::Image &image = reader.GetImage();
const unsigned int *dims = image.GetDimensions();
- std::cout << image << std::endl;
+ //std::cout << image << std::endl;
const gdcm::DataElement &pixeldata = image.GetDataElement();
const gdcm::ByteValue *bv = pixeldata.GetByteValue();
unsigned long slice_len = image.GetBufferLength() / dims[2];
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=97686bde99dfb7331ccd8a0404aadb87adb997a1
commit 97686bde99dfb7331ccd8a0404aadb87adb997a1
Author: Mathieu Malaterre <mat...@gm...>
Date: Thu Jan 27 11:18:45 2011 +0100
Adding vtkgdcm PHP wrapping
diff --git a/Utilities/VTK/CMakeLists.txt b/Utilities/VTK/CMakeLists.txt
index 6f5e6d2..8754907 100644
--- a/Utilities/VTK/CMakeLists.txt
+++ b/Utilities/VTK/CMakeLists.txt
@@ -166,6 +166,64 @@ IF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
)
ENDIF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
+IF(GDCM_WRAP_PHP)
+ IF( "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" LESS 4.5 )
+ MESSAGE(FATAL_ERROR "you need a newer VTK version >= 5.0")
+ ENDIF( "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" LESS 4.5 )
+
+FIND_PACKAGE(PHP5 REQUIRED)
+INCLUDE_DIRECTORIES(
+ ${PHP5_INCLUDE_PATH}
+)
+
+ FIND_PACKAGE(SWIG REQUIRED)
+ MARK_AS_ADVANCED(SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION)
+ INCLUDE(${SWIG_USE_FILE})
+ SET_SOURCE_FILES_PROPERTIES(vtkgdcm.i PROPERTIES CPLUSPLUS ON)
+ #SET_SOURCE_FILES_PROPERTIES(vtkgdcm.i PROPERTIES COMPILE_FLAGS -DUSEACTIVIZ)
+ #IF(GDCM_USE_ACTIVIZ)
+ #SET(CMAKE_SWIG_FLAGS "-namespace vtkgdcm -dllimport vtkgdcmsharpglue -DUSEACTIVIZ")
+ #ELSE(GDCM_USE_ACTIVIZ)
+ #SET(CMAKE_SWIG_FLAGS "-namespace vtkgdcm -dllimport vtkgdcmsharpglue")
+ #ENDIF(GDCM_USE_ACTIVIZ)
+ #SEPARATE_ARGUMENTS(CMAKE_SWIG_FLAGS)
+
+ SWIG_ADD_MODULE(php_vtkgdcm php vtkgdcm.i)
+ SWIG_LINK_LIBRARIES(php_vtkgdcm vtkgdcm)
+ IF(UNIX)
+ SET_TARGET_PROPERTIES(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} PROPERTIES OUTPUT_NAME "vtkgdcm")
+ ENDIF(UNIX)
+ SET_TARGET_PROPERTIES(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} PROPERTIES PREFIX "")
+ SET_TARGET_PROPERTIES(${SWIG_MODULE_php_vtkgdcm_REAL_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "")
+
+IF(NOT GDCM_INSTALL_NO_LIBRARIES)
+ INSTALL(TARGETS ${SWIG_MODULE_php_vtkgdcm_REAL_NAME}
+ EXPORT ${GDCM_TARGETS_NAME}
+ RUNTIME DESTINATION ${GDCM_INSTALL_BIN_DIR} COMPONENT Applications
+ LIBRARY DESTINATION ${GDCM_INSTALL_LIB_DIR} COMPONENT Libraries #${NAMELINK_SKIP}
+ ARCHIVE DESTINATION ${GDCM_INSTALL_LIB_DIR} COMPONENT Development
+ )
+#if(NAMELINK_ONLY)
+# INSTALL(TARGETS ${SWIG_MODULE_vtkgdcmsharpglue_REAL_NAME}
+# LIBRARY DESTINATION ${GDCM_INSTALL_LIB_DIR} COMPONENT Development ${NAMELINK_ONLY}
+# )
+# endif(NAMELINK_ONLY)
+
+# Let's copy vtkgdcm.php into the bin dir:
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${LIBRARY_OUTPUT_PATH}/vtkgdcm.php
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/vtkgdcm.php ${LIBRARY_OUTPUT_PATH}/vtkgdcm.php
+ DEPENDS "${swig_generated_file_fullname}"
+ COMMENT "copying vtkgdcm.php"
+)
+ADD_CUSTOM_TARGET(VTKGDCMPHP ALL
+ DEPENDS ${LIBRARY_OUTPUT_PATH}/vtkgdcm.php
+ COMMENT "building vtkgdcm.php"
+)
+
+ENDIF(NOT GDCM_INSTALL_NO_LIBRARIES)
+ENDIF(GDCM_WRAP_PHP)
+
IF(GDCM_WRAP_CSHARP)
IF( "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" LESS 4.5 )
MESSAGE(FATAL_ERROR "you need a newer VTK version >= 5.0")
diff --git a/Utilities/VTK/vtkgdcm.i b/Utilities/VTK/vtkgdcm.i
index 6b1b3fe..ad8ad66 100644
--- a/Utilities/VTK/vtkgdcm.i
+++ b/Utilities/VTK/vtkgdcm.i
@@ -25,6 +25,12 @@
%}
#endif
+#if defined(SWIGPHP)
+%{
+#define SWIGPHP
+%}
+#endif
+
%{
//#define VTK_MAJOR_VERSION 5
//#define VTK_MINOR_VERSION 4
@@ -75,6 +81,8 @@
#include "vtkVolumeReader.h"
#include "vtkVolume16Reader.h"
+#include "vtkWindowToImageFilter.h"
+
#include "vtkToolkits.h" // VTK_DATA_ROOT
%}
@@ -111,6 +119,7 @@ using Kitware.VTK;
#define VTK_FILTERING_EXPORT
#define VTK_IO_EXPORT
#define VTK_IMAGING_EXPORT
+#define VTK_RENDERING_EXPORT
// FIXME. Including #include vtkSetGet would not work on siwg 1.3.33 ...
@@ -346,7 +355,9 @@ using Kitware.VTK;
}
%include "vtkObjectBase.h"
+#ifdef SWIGCSHARP
%csmethodmodifiers vtkObjectBase::ToString() "public override"
+#endif
%extend vtkObjectBase
{
const char *ToString()
@@ -477,6 +488,22 @@ while we would want:
%}
};
+#ifdef SWIGPHP
+%extend vtkGDCMImageReader
+{
+//public function __construct2($res=null) {
+// $this->_cPtr=vtkGDCMImageReader_Create();
+//}
+
+//%typemap(out) vtkGDCMImageReader* (vtkGDCMImageReader::New)
+//%{
+//public function __construct($res=null) {
+// $this->_cPtr=vtkGDCMImageReader_Create();
+//}
+//%}
+};
+#endif
+
%extend vtkGDCMImageWriter
{
%typemap(cscode) vtkGDCMImageWriter
@@ -492,6 +519,10 @@ while we would want:
%clear double* GetDataSpacing();
%clear double* GetDataOrigin();
+#ifdef SWIGPHP
+%include "vtkWindowToImageFilter.h"
+#endif
+
#ifndef USEACTIVIZ
%include "vtkImageExport.h"
%include "vtkImageImport.h"
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=2d2ec3230f5c55d8ee50a76a58c10b264c166323
commit 2d2ec3230f5c55d8ee50a76a58c10b264c166323
Author: Mathieu Malaterre <mat...@gm...>
Date: Thu Jan 27 11:17:01 2011 +0100
Adding a simple pipeline to execute offline rendering
diff --git a/Utilities/VTK/Examples/Cxx/CMakeLists.txt b/Utilities/VTK/Examples/Cxx/CMakeLists.txt
index 0ad28f0..fc31fcc 100644
--- a/Utilities/VTK/Examples/Cxx/CMakeLists.txt
+++ b/Utilities/VTK/Examples/Cxx/CMakeLists.txt
@@ -7,6 +7,7 @@ IF( "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" GREATER 5.0 )
SET(GDCM_VTK_APPS
ConvertSingleBitTo8Bits
GenerateRTSTRUCT
+ offscreenimage
)
IF(VTK_USE_RENDERING)
SET(GDCM_VTK_APPS
diff --git a/Utilities/VTK/Examples/Cxx/offscreenimage.cxx b/Utilities/VTK/Examples/Cxx/offscreenimage.cxx
new file mode 100644
index 0000000..4545ee8
--- /dev/null
+++ b/Utilities/VTK/Examples/Cxx/offscreenimage.cxx
@@ -0,0 +1,79 @@
+/*=========================================================================
+
+ Program: GDCM (Grassroots DICOM). A DICOM library
+ Module: $URL$
+
+ Copyright (c) 2006-2010 Mathieu Malaterre
+ All rights reserved.
+ See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html 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.
+
+=========================================================================*/
+#include "vtkGDCMImageReader.h"
+#include "vtkRenderWindow.h"
+#include "vtkRenderer.h"
+#include "vtkImageMapToWindowLevelColors.h"
+#include "vtkImageActor.h"
+#include "vtkPNGWriter.h"
+#include "vtkWindowToImageFilter.h"
+#include "vtkMedicalImageProperties.h"
+
+int main(int argc, char *argv[])
+{
+ if( argc < 2 )
+ {
+ return 1;
+ }
+ const char *filename = argv[1];
+
+ vtkGDCMImageReader *reader = vtkGDCMImageReader::New();
+ reader->SetFileName( filename );
+ reader->Update(); // important to read the window/level info
+
+ vtkMedicalImageProperties *prop = reader->GetMedicalImageProperties();
+
+ vtkRenderWindow *renWin = vtkRenderWindow::New();
+ renWin->OffScreenRenderingOn();
+
+ vtkRenderer *renderer = vtkRenderer::New();
+ renWin->AddRenderer(renderer);
+
+ vtkImageMapToWindowLevelColors *windowlevel = vtkImageMapToWindowLevelColors::New();
+ windowlevel->SetInput( reader->GetOutput() );
+ unsigned int n = prop->GetNumberOfWindowLevelPresets();
+ if( n )
+ {
+ // Take the first one by default:
+ const double *wl = prop->GetNthWindowLevelPreset(0);
+ windowlevel->SetWindow( wl[0] );
+ windowlevel->SetLevel( wl[1] );
+ }
+
+ vtkImageActor *actor = vtkImageActor::New();
+ actor->SetInput( windowlevel->GetOutput() );
+
+ renderer->AddActor( actor );
+
+ renWin->Render();
+
+ vtkWindowToImageFilter *w2if = vtkWindowToImageFilter::New();
+ w2if->SetInput ( renWin );
+
+ vtkPNGWriter *wr = vtkPNGWriter::New();
+ wr->SetInput( w2if->GetOutput() );
+ wr->SetFileName ( "offscreenimage.png" );
+ wr->Write();
+
+ reader->Delete();
+ renWin->Delete();
+ renderer->Delete();
+ windowlevel->Delete();
+ actor->Delete();
+ w2if->Delete();
+ wr->Delete();
+
+ return 0;
+}
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=609adecd89c8db66f7178d316ba031abf40315a1
commit 609adecd89c8db66f7178d316ba031abf40315a1
Author: Mathieu Malaterre <mat...@gm...>
Date: Wed Jan 26 18:32:10 2011 +0100
Make sure to copy gdcm.php to proper location
diff --git a/Wrapping/PHP/CMakeLists.txt b/Wrapping/PHP/CMakeLists.txt
index 01464bc..eef3836 100644
--- a/Wrapping/PHP/CMakeLists.txt
+++ b/Wrapping/PHP/CMakeLists.txt
@@ -48,6 +48,18 @@ IF(UNIX)
SET_TARGET_PROPERTIES(${SWIG_MODULE_php_gdcm_REAL_NAME} PROPERTIES OUTPUT_NAME "gdcm")
ENDIF(UNIX)
+# Let's copy gdcm.php into the bin dir:
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${LIBRARY_OUTPUT_PATH}/gdcm.php
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/gdcm.php ${LIBRARY_OUTPUT_PATH}/gdcm.php
+ DEPENDS "${swig_generated_file_fullname}"
+ COMMENT "copying gdcm.php"
+)
+ADD_CUSTOM_TARGET(GDCMPHP ALL
+ DEPENDS ${LIBRARY_OUTPUT_PATH}/gdcm.php
+ COMMENT "building gdcm.php"
+)
+
# Module are always place in the library destination
# but for poor win32 user I decided to place them
# right next to the other dlls
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=c0f64ab685975ea5ff821e423018154fc066d29b
commit c0f64ab685975ea5ff821e423018154fc066d29b
Author: Mathieu Malaterre <mat...@gm...>
Date: Wed Jan 26 18:31:00 2011 +0100
Adding documentation for running PHP module.
diff --git a/Examples/PHP/README.txt b/Examples/PHP/README.txt
new file mode 100644
index 0000000..65c8cd1
--- /dev/null
+++ b/Examples/PHP/README.txt
@@ -0,0 +1,2 @@
+php -d enable_dl=On test.php
+sudo cp bin/gdcm.so /usr/lib/php5/20090626/gdcm.so
-----------------------------------------------------------------------
Summary of changes:
Applications/Cxx/gdcmtar.cxx | 20 +++++--
Examples/PHP/README.txt | 2 +
Utilities/VTK/CMakeLists.txt | 58 ++++++++++++++++++
Utilities/VTK/Examples/Cxx/CMakeLists.txt | 1 +
Utilities/VTK/Examples/Cxx/offscreenimage.cxx | 79 +++++++++++++++++++++++++
Utilities/VTK/vtkgdcm.i | 31 ++++++++++
Wrapping/PHP/CMakeLists.txt | 12 ++++
7 files changed, 198 insertions(+), 5 deletions(-)
create mode 100644 Examples/PHP/README.txt
create mode 100644 Utilities/VTK/Examples/Cxx/offscreenimage.cxx
hooks/post-receive
--
Grassroots DICOM
|