[Gdcm-hackers] gdcm-git:Grassroots DICOM branch master updated. 7f3b2cdc6bbc7d58468641498f9fb9c2ef2
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: Mathieu M. <ma...@us...> - 2011-05-25 09:28:20
|
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 7f3b2cdc6bbc7d58468641498f9fb9c2ef2236c7 (commit)
from 37f57aec45af5a997401fff61047a5fff912f77a (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=7f3b2cdc6bbc7d58468641498f9fb9c2ef2236c7
commit 7f3b2cdc6bbc7d58468641498f9fb9c2ef2236c7
Author: Mathieu Malaterre <mat...@gm...>
Date: Wed May 25 11:27:38 2011 +0200
Make sure BMP without LUT are read as RGB not PALETTE
diff --git a/Utilities/VTK/Applications/gdcm2vtk.cxx b/Utilities/VTK/Applications/gdcm2vtk.cxx
index b490010..b935ec8 100644
--- a/Utilities/VTK/Applications/gdcm2vtk.cxx
+++ b/Utilities/VTK/Applications/gdcm2vtk.cxx
@@ -25,6 +25,7 @@
#include "vtkImageData.h"
#include "vtkTIFFWriter.h"
#include "vtkPNGWriter.h"
+#include "vtkBMPWriter.h"
#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
#include "vtkMetaImageReader.h"
#include "vtkXMLImageDataReader.h"
@@ -452,6 +453,22 @@ int main(int argc, char *argv[])
writer->Delete();
goto cleanup;
}
+ else if( gdcm::System::StrCaseCmp(outputextension,".bmp") == 0 )
+ {
+ vtkBMPWriter * writer = vtkBMPWriter::New();
+ writer->SetFileName( outfilename );
+ writer->SetInput( imgdata );
+ writer->Write();
+#if VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION > 0
+ if( writer->GetErrorCode() )
+ {
+ std::cerr << "There was an error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) << std::endl;
+ retcode = 1;
+ }
+#endif
+ writer->Delete();
+ goto cleanup;
+ }
else if( gdcm::System::StrCaseCmp(outputextension,".png") == 0 )
{
vtkPNGWriter * writer = vtkPNGWriter::New();
@@ -686,8 +703,11 @@ int main(int argc, char *argv[])
//reader->GetLookupTable()->Print( std::cout );
if( palettecolor )
{
- reader->GetOutput()->GetPointData()->GetScalars()->SetLookupTable( reader->GetLookupTable() );
- writer->SetImageFormat( VTK_LOOKUP_TABLE );
+ if( reader->GetNumberOfScalarComponents() == 1 )
+ {
+ reader->GetOutput()->GetPointData()->GetScalars()->SetLookupTable( reader->GetLookupTable() );
+ writer->SetImageFormat( VTK_LOOKUP_TABLE );
+ }
}
}
else if( vtkGESignaReader * reader = vtkGESignaReader::SafeDownCast(imgreader) )
diff --git a/Utilities/VTK/vtkGDCMImageWriter.cxx b/Utilities/VTK/vtkGDCMImageWriter.cxx
index 007a676..d7852c6 100644
--- a/Utilities/VTK/vtkGDCMImageWriter.cxx
+++ b/Utilities/VTK/vtkGDCMImageWriter.cxx
@@ -660,6 +660,7 @@ int vtkGDCMImageWriter::WriteGDCMData(vtkImageData *data, int timeStep)
// Setup LUT if any:
if( pi == gdcm::PhotometricInterpretation::PALETTE_COLOR )
{
+ assert( pixeltype.GetSamplesPerPixel() == 1 );
vtkLookupTable * vtklut = data->GetPointData()->GetScalars()->GetLookupTable();
//vtkLookupTable * vtklut = this->LookupTable;
assert( vtklut );
@@ -1281,4 +1282,4 @@ void vtkGDCMImageWriter::SetDirectionCosinesFromImageOrientationPatient(const do
void vtkGDCMImageWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
-}
\ No newline at end of file
+}
-----------------------------------------------------------------------
Summary of changes:
Utilities/VTK/Applications/gdcm2vtk.cxx | 24 ++++++++++++++++++++++--
Utilities/VTK/vtkGDCMImageWriter.cxx | 3 ++-
2 files changed, 24 insertions(+), 3 deletions(-)
hooks/post-receive
--
Grassroots DICOM
|