[Gdcm-hackers] gdcm-git:Grassroots DICOM branch master updated. e3e663536c77dce681d8d3591214cac1cbb
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: Mathieu M. <ma...@us...> - 2011-01-28 15:48:41
|
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 e3e663536c77dce681d8d3591214cac1cbbe0fda (commit)
via b99dcc7bb5b65dbe3bc263216946108838a875af (commit)
via f14f2ab8f9d4307f6157def4211601fba8ae15ed (commit)
via 75cca96d832c8dbc7ef45d5303edde23e6b64b93 (commit)
via 2599da1c75d46a0d66283ebd345d584e441fecb8 (commit)
from 6f4a4ed6b73f46bea773c59b9167e637f15b3293 (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=e3e663536c77dce681d8d3591214cac1cbbe0fda
commit e3e663536c77dce681d8d3591214cac1cbbe0fda
Author: Mathieu Malaterre <mat...@gm...>
Date: Fri Jan 28 16:48:19 2011 +0100
Adding an example for vtkgdcm + PHP
diff --git a/Utilities/VTK/Examples/PHP/generate_png.php b/Utilities/VTK/Examples/PHP/generate_png.php
new file mode 100644
index 0000000..6d4fa5a
--- /dev/null
+++ b/Utilities/VTK/Examples/PHP/generate_png.php
@@ -0,0 +1,68 @@
+<?php
+/*=========================================================================
+
+ 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.
+
+=========================================================================*/
+
+/*
+ */
+require_once( 'vtkgdcm.php' );
+
+//$reader = new vtkGDCMImageReader();
+$reader = vtkGDCMImageReader::c_New();
+$reader->SetFilename( "test.dcm" );
+$reader->Update();
+
+$prop = $reader->GetMedicalImageProperties();
+
+$n = $prop->GetNumberOfWindowLevelPresets();
+print( "coudou" );
+//print( "coucou %d", $n );
+if( $n != 0 )
+{
+// Take the first one by default:
+$w = 0;
+$l = 0;
+$a = $prop->GetNthWindowLevelPreset(0);
+print( $a[0] );
+//$windowlevel->SetWindow( wl[0] );
+//$windowlevel->SetLevel( wl[1] );
+}
+
+/*
+$renderer = vtkRenderer::c_New();
+
+$windowlevel = vtkImageMapToWindowLevelColors::c_New();
+$windowlevel->SetInput( $reader->GetOutput() );
+
+$actor = vtkImageActor::c_New();
+$actor->SetInput( $windowlevel->GetOutput() );
+
+$renderer->AddActor( actor );
+
+$renWin = vtkRenderWindow::c_New();
+$renWin->OffScreenRenderingOn();
+$renWin->AddRenderer($renderer);
+
+$renWin->Render();
+
+$w2if = vtkWindowToImageFilter::c_New();
+$w2if->SetInput ( $renWin );
+
+$wr = vtkPNGWriter::c_New();
+$wr->SetInput( $w2if->GetOutput() );
+$wr->SetFileName ( "offscreenimage.png" );
+$wr->Write();
+*/
+
+?>
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=b99dcc7bb5b65dbe3bc263216946108838a875af
commit b99dcc7bb5b65dbe3bc263216946108838a875af
Author: Mathieu Malaterre <mat...@gm...>
Date: Fri Jan 28 16:47:27 2011 +0100
Some more work on gdcmtar
diff --git a/Applications/Cxx/gdcmtar.cxx b/Applications/Cxx/gdcmtar.cxx
index 8ee0044..6061cbc 100644
--- a/Applications/Cxx/gdcmtar.cxx
+++ b/Applications/Cxx/gdcmtar.cxx
@@ -1041,6 +1041,10 @@ int main (int argc, char *argv[])
return 1;
}
+ // Preserve info:
+ gdcm::DataElement oldsopclassuid = ds.GetDataElement( gdcm::Tag(0x8,0x16) );
+ gdcm::DataElement oldinstanceuid = ds.GetDataElement( gdcm::Tag(0x8,0x18) );
+
// Ok then change it old Old MR Image Storage
gdcm::DataElement de( gdcm::Tag(0x0008, 0x0016) );
ms = gdcm::MediaStorage::MRImageStorage;
@@ -1091,6 +1095,18 @@ int main (int argc, char *argv[])
//ds.Remove( gdcm::Tag( 0x0008,0x0012) );
//ds.Remove( gdcm::Tag( 0x0008,0x0013) );
+ // reference the old instance:
+ // PS 3.3-2009 C.7.6.16.1.3
+#if 0
+ assert( ds.FindDataElement( gdcm::Tag(0x0008,0x1150) ) == false );
+ assert( ds.FindDataElement( gdcm::Tag(0x0008,0x1155) ) == false );
+ assert( ds.FindDataElement( gdcm::Tag(0x0008,0x1160) ) == false );
+ oldsopclassuid.SetTag( gdcm::Tag(0x8,0x1150) );
+ oldinstanceuid.SetTag( gdcm::Tag(0x8,0x1155) );
+ ds.Insert( oldsopclassuid );
+ ds.Insert( oldinstanceuid );
+#endif
+
char date[22];
const size_t datelen = 8;
int res = gdcm::System::GetCurrentDateTime(date);
@@ -1100,6 +1116,10 @@ int main (int argc, char *argv[])
gdcm::Attribute<0x8,0x13> instcreationtime;
instcreationtime.SetValue( gdcm::DTComp( date + datelen, 13 ) );
ds.Replace( instcreationtime.GetAsDataElement() );
+ const char *offset = gdcm::System::GetTimezoneOffsetFromUTC();
+ gdcm::Attribute<0x8,0x201> timezoneoffsetfromutc;
+ timezoneoffsetfromutc.SetValue( offset );
+ ds.Replace( timezoneoffsetfromutc.GetAsDataElement() );
for(unsigned int i = 0; i < dims[2]; ++i)
{
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=f14f2ab8f9d4307f6157def4211601fba8ae15ed
commit f14f2ab8f9d4307f6157def4211601fba8ae15ed
Author: Mathieu Malaterre <mat...@gm...>
Date: Fri Jan 28 16:44:51 2011 +0100
Adding a new function to compute the offset from timezone UTC
diff --git a/Source/Common/gdcmSystem.cxx b/Source/Common/gdcmSystem.cxx
index 75d49d3..a0a6278 100644
--- a/Source/Common/gdcmSystem.cxx
+++ b/Source/Common/gdcmSystem.cxx
@@ -692,6 +692,18 @@ bool System::ParseDateTime(time_t &timep, long &milliseconds, const char date[22
return true;
}
+const char *System::GetTimezoneOffsetFromUTC()
+{
+ static std::string buffer;
+ char outstr[10];
+ time_t t = time(NULL);
+ struct tm *tmp = localtime(&t);
+ size_t l = strftime(outstr, sizeof(outstr), "%z", tmp);
+ assert( l == 5 );
+ buffer = outstr;
+ return buffer.c_str();
+}
+
bool System::FormatDateTime(char date[22], time_t timep, long milliseconds)
{
// \precondition
@@ -765,18 +777,13 @@ bool System::GetCurrentDateTime(char date[22])
struct timeval tv;
gettimeofday (&tv, NULL);
timep = tv.tv_sec;
- // A concatenated date-time character string in
- // the format:
+ // A concatenated date-time character string in the format:
// YYYYMMDDHHMMSS.FFFFFF&ZZXX
- // The components of this string, from left to
- // right, are YYYY = Year, MM = Month, DD =
- // Day, HH = Hour (range "00" - "23"), MM =
- // Minute (range "00" - "59"), SS = Second
- // (range "00" - "60").
- // FFFFFF = Fractional Second contains a
- // fractional part of a second as small as 1
- // millionth of a second (range ¿000000¿ -
- // ¿999999¿).
+ // The components of this string, from left to right, are YYYY = Year, MM =
+ // Month, DD = Day, HH = Hour (range "00" - "23"), MM = Minute (range "00" -
+ // "59"), SS = Second (range "00" - "60").
+ // FFFFFF = Fractional Second contains a fractional part of a second as small
+ // as 1 millionth of a second (range 000000 - 999999).
assert( tv.tv_usec >= 0 && tv.tv_usec < 1000000 );
milliseconds = tv.tv_usec;
diff --git a/Source/Common/gdcmSystem.h b/Source/Common/gdcmSystem.h
index 70af2b5..d97086b 100644
--- a/Source/Common/gdcmSystem.h
+++ b/Source/Common/gdcmSystem.h
@@ -97,6 +97,10 @@ public:
/// \see FormatDateTime
static bool ParseDateTime(time_t &timep, long &milliseconds, const char date[22]);
+ /// Return the value for Timezone Offset From UTC as string.
+ /// \warning not thread safe
+ static const char *GetTimezoneOffsetFromUTC();
+
/// Encode bytes
static size_t EncodeBytes(char *out, const unsigned char *data, int size);
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=75cca96d832c8dbc7ef45d5303edde23e6b64b93
commit 75cca96d832c8dbc7ef45d5303edde23e6b64b93
Author: Mathieu Malaterre <mat...@gm...>
Date: Fri Jan 28 16:44:26 2011 +0100
Remove a warning in release mode
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmExplicitDataElement.txx b/Source/DataStructureAndEncodingDefinition/gdcmExplicitDataElement.txx
index bdad67c..6d2f934 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmExplicitDataElement.txx
+++ b/Source/DataStructureAndEncodingDefinition/gdcmExplicitDataElement.txx
@@ -506,6 +506,7 @@ const std::ostream &ExplicitDataElement::Write(std::ostream &os) const
failed = !ValueIO<ExplicitDataElement,TSwap,uint64_t>::Write(os,*ValueField);
break;
default:
+ failed = true;
assert(0);
}
}
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=2599da1c75d46a0d66283ebd345d584e441fecb8
commit 2599da1c75d46a0d66283ebd345d584e441fecb8
Author: Mathieu Malaterre <mat...@gm...>
Date: Fri Jan 28 16:43:59 2011 +0100
Remove a warning and expose an issue in the test suite.
diff --git a/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx b/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
index 6dd0222..9a7d42b 100644
--- a/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
+++ b/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
@@ -36,7 +36,7 @@ gdcm::network::ULConnectionManager *GetConnectionManager()
{
gdcm::network::ULConnectionManager *theManager =
new gdcm::network::ULConnectionManager();
- gdcm::BaseRootQuery* theQuery;
+ gdcm::BaseRootQuery* theQuery = NULL;
//!!! Mathieu, this code will crash because theQuery is not initialized
if (!theManager->EstablishConnection(AETitle, PeerAETitle, ComputerName, 0,
port, 1000, gdcm::network::eFind, theQuery->GetQueryDataSet()))
-----------------------------------------------------------------------
Summary of changes:
Applications/Cxx/gdcmtar.cxx | 20 ++++++
Source/Common/gdcmSystem.cxx | 29 +++++---
Source/Common/gdcmSystem.h | 4 +
.../gdcmExplicitDataElement.txx | 1 +
.../Cxx/TestSCUValidation.cxx | 2 +-
Utilities/VTK/Examples/PHP/generate_png.php | 68 ++++++++++++++++++++
6 files changed, 112 insertions(+), 12 deletions(-)
create mode 100644 Utilities/VTK/Examples/PHP/generate_png.php
hooks/post-receive
--
Grassroots DICOM
|