[Gdcm-hackers] gdcm-git:Grassroots DICOM branch master updated. f35c4876015682222ea10a23d207213eed1
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: Mathieu M. <ma...@us...> - 2013-03-13 12:10:13
|
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 f35c4876015682222ea10a23d207213eed1673af (commit)
via 5adf0086688dc8c9055c8ec492407bfb2ec222c7 (commit)
via 81f38a6275a5e815adc85196a592f03511af4029 (commit)
via d19fdba396f0c941cafab4a2d189882ed56c6da8 (commit)
via cb7333c70877377adefa8aaab49fd0f9f3c26f85 (commit)
from d33e6a2472850cd6de36a0334dcf0f3974cf2ef4 (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 -----------------------------------------------------------------
https://sourceforge.net/p/gdcm/gdcm/ci/f35c4876015682222ea10a23d207213eed1673af/
commit f35c4876015682222ea10a23d207213eed1673af
Merge: d19fdba 5adf008
Author: Mathieu Malaterre <mat...@gm...>
Date: Wed Mar 13 13:06:28 2013 +0100
Merge branch 'release'
https://sourceforge.net/p/gdcm/gdcm/ci/d19fdba396f0c941cafab4a2d189882ed56c6da8/
commit d19fdba396f0c941cafab4a2d189882ed56c6da8
Author: Mathieu Malaterre <mat...@gm...>
Date: Wed Mar 13 13:05:26 2013 +0100
Implement more options in gdcmimg
This commit add support for BitsAllocated,BitsStored and HighBits when needed
It also allow for specifying PhotometricInterpretation
diff --git a/Applications/Cxx/gdcmimg.cxx b/Applications/Cxx/gdcmimg.cxx
index d760c89..02dd774 100644
--- a/Applications/Cxx/gdcmimg.cxx
+++ b/Applications/Cxx/gdcmimg.cxx
@@ -130,6 +130,8 @@ static void PrintHelp()
std::cout << " --sign %s Pixel sign (0/1)." << std::endl;
std::cout << " --spp %d Sample Per Pixel (1/3)." << std::endl;
std::cout << " --pc [01] Change planar configuration." << std::endl;
+ std::cout << " --pi [str] Change photometric interpretation." << std::endl;
+ std::cout << " --pf %d,%d,%d Change pixel format: (BA,BS,HB)." << std::endl;
std::cout << " -s --size %d,%d Size." << std::endl;
std::cout << " -C --sop-class-uid SOP Class UID (name or value)." << std::endl;
std::cout << " -T --study-uid Study UID." << std::endl;
@@ -414,6 +416,10 @@ int main (int argc, char *argv[])
std::string sopclass;
std::string lsb_msb;
int sopclassuid = 0;
+ int pinter = 0;
+ std::string pinterstr;
+ int pformat = 0;
+ std::string pformatstr;
int verbose = 0;
int warning = 0;
@@ -445,6 +451,8 @@ int main (int argc, char *argv[])
{"sign", 1, &sign, 1}, //
{"spp", 1, &spp, 1}, //
{"pc", 1, &pconf, 1}, //
+ {"pi", 1, &pinter, 1}, //
+ {"pf", 1, &pformat, 1}, //
// General options !
{"verbose", 0, &verbose, 1},
@@ -541,6 +549,18 @@ int main (int argc, char *argv[])
assert( strcmp(s, "pc") == 0 );
pconf = atoi(optarg);
}
+ else if( option_index == 14 ) /* pinter */
+ {
+ assert( strcmp(s, "pi") == 0 );
+ pinter = 1;
+ pinterstr = optarg;
+ }
+ else if( option_index == 15 ) /* pformat */
+ {
+ assert( strcmp(s, "pf") == 0 );
+ pformat = 1;
+ pformatstr = optarg;
+ }
//printf (" with arg %s", optarg);
}
//printf ("\n");
@@ -754,6 +774,31 @@ int main (int argc, char *argv[])
{
if( pixelspp != 3 ) return 1;
}
+ gdcm::PixelFormat pfref = gdcm::PixelFormat::UINT8;
+ if( pformat )
+ {
+ int ba, bs, hb;
+ int n = sscanf( pformatstr.c_str(), "%d,%d,%d", &ba, &bs, &hb );
+ if( n != 3 ) return 1;
+ pfref.SetBitsAllocated( ba );
+ pfref.SetBitsStored( bs );
+ pfref.SetHighBit( hb );
+ if( spp )
+ pfref.SetSamplesPerPixel( pixelspp );
+ if( sign )
+ pfref.SetPixelRepresentation( pixelsign );
+ }
+ gdcm::PhotometricInterpretation::PIType refpi = gdcm::PhotometricInterpretation::MONOCHROME2;
+ if( pinter )
+ {
+ refpi = gdcm::PhotometricInterpretation::GetPIType( pinterstr.c_str() );
+ if( refpi == gdcm::PhotometricInterpretation::UNKNOW
+ || refpi == gdcm::PhotometricInterpretation::PI_END )
+ {
+ std::cerr << "Invalid PI: " << pinterstr << std::endl;
+ return 1;
+ }
+ }
const char *inputextension = filename.GetExtension();
const char *outputextension = outfilename.GetExtension();
@@ -784,7 +829,7 @@ int main (int argc, char *argv[])
}
raw.SetDimensions( dims );
gdcm::PixelFormat pf = gdcm::PixelFormat::UINT8;
- gdcm::PhotometricInterpretation pi = gdcm::PhotometricInterpretation::MONOCHROME2;
+ gdcm::PhotometricInterpretation pi = refpi;
if( gdcm::System::StrCaseCmp(inputextension,".rgb") == 0 )
{
pi = gdcm::PhotometricInterpretation::RGB;
@@ -847,7 +892,7 @@ int main (int argc, char *argv[])
gdcm::PixelFormat pf = gdcm::PixelFormat::UINT8;
if( !GetPixelFormat( pf, depth, bpp, sign, pixelsign ) ) return 1;
rle.SetPixelFormat( pf );
- gdcm::PhotometricInterpretation pi = gdcm::PhotometricInterpretation::MONOCHROME2;
+ gdcm::PhotometricInterpretation pi = refpi;
rle.SetPhotometricInterpretation( pi );
if( !Populate( writer, rle, filenames ) ) return 1;
@@ -867,8 +912,22 @@ int main (int argc, char *argv[])
|| gdcm::System::StrCaseCmp(inputextension,".ppm") == 0 )
{
gdcm::PNMCodec pnm;
+ // Let's handle the case where user really wants to specify the data:
+ gdcm::PixelFormat pf = gdcm::PixelFormat::UINT8;
+ if( !GetPixelFormat( pf, depth, bpp, sign, pixelsign ) ) return 1;
+
gdcm::PixmapWriter writer;
if( !Populate( writer, pnm, filenames ) ) return 1;
+ // populate will guess pixel format and photometric inter from file, need
+ // to override after calling Populate:
+ if( pformat )
+ {
+ writer.GetPixmap().SetPixelFormat( pfref );
+ }
+ if( pinter )
+ {
+ writer.GetPixmap().SetPhotometricInterpretation( refpi );
+ }
if( !AddUIDs(sopclassuid, sopclass, study_uid, series_uid, writer ) ) return 1;
writer.SetFileName( outfilename );
https://sourceforge.net/p/gdcm/gdcm/ci/cb7333c70877377adefa8aaab49fd0f9f3c26f85/
commit cb7333c70877377adefa8aaab49fd0f9f3c26f85
Author: Mathieu Malaterre <mat...@gm...>
Date: Wed Mar 13 13:05:11 2013 +0100
Remove a warning about assert being redefined
diff --git a/Utilities/gdcmcharls/config.h b/Utilities/gdcmcharls/config.h
index ec90c21..ce7b42b 100644
--- a/Utilities/gdcmcharls/config.h
+++ b/Utilities/gdcmcharls/config.h
@@ -9,7 +9,6 @@
#ifdef NDEBUG
# ifndef ASSERT
# define ASSERT(t) { }
-# define assert(t) { }
# endif
#else
#include <assert.h>
-----------------------------------------------------------------------
Summary of changes:
Applications/Cxx/gdcmimg.cxx | 63 +++++++++++++++++++++++++++++++++++++++-
Utilities/gdcmcharls/config.h | 1 -
2 files changed, 61 insertions(+), 3 deletions(-)
hooks/post-receive
--
Grassroots DICOM
|