Correct bug between std and wxvtk packages (wxvtk needs std package).
Correct a _CRT_SECURE_NO_DEPRECATE warning
#-----------------------------------------------------------------------------
ADD_SUBDIRECTORY(data)
#-----------------------------------------------------------------------------
-ADD_SUBDIRECTORY(bin)
\ No newline at end of file
+ADD_SUBDIRECTORY(bin)
ENDIF(${BBTK_PACKAGE_NAME}_USE_QT)
IF(${BBTK_PACKAGE_NAME}_USE_GDCM)
- SET(USE_GDCM ON CACHE BOOL "Use GDCM" FORCE)
+ SET(USE_GDCM OFF CACHE BOOL "Use GDCM" )
+ SET(USE_GDCM2 OFF CACHE BOOL "Use GDCM2" )
SET(USE_GDCM_VTK ON CACHE BOOL "Use GDCM_VTK" FORCE)
SET(${BBTK_PACKAGE_NAME}_LIBS
${${BBTK_PACKAGE_NAME}_LIBS}
${GDCM_LIBRARIES}
)
+
+ IF(USE_GDCM)
+ IF(USE_GDCM2)
+ message(FATAL_ERROR "we have to choose between DICOM library readers")
+ ENDIF(USE_GDCM2)
+ ENDIF(USE_GDCM)
ENDIF(${BBTK_PACKAGE_NAME}_USE_GDCM)
IF(${BBTK_PACKAGE_NAME}_USE_GDCM2)
ENDIF(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS)
+
#---------------------------------------------------------------------------
MESSAGE(STATUS "")
MESSAGE(STATUS "")
#---------------------------------------------------------------------------
-# Recurse into subdirs
-SUBDIRS(src)
-SUBDIRS(doc)
-SUBDIRS(bbs)
-SUBDIRS(data)
+# Recurse into ADD_SUBDIRECTORY
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(doc)
+ADD_SUBDIRECTORY(bbs)
+ADD_SUBDIRECTORY(data)
#---------------------------------------------------------------------------
MESSAGE(STATUS "=======================================")
Program: bbtk
Module: $RCSfile: bbtkConfigurationFile.h,v $
Language: C++
- Date: $Date: 2009/01/27 14:22:56 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2010/11/22 16:44:27 $
+ Version: $Revision: 1.12 $
=========================================================================*/
/* ---------------------------------------------------------------------
#ifdef WIN32
-#define _CRT_SECURE_NO_DEPRECATE
+ #if __VISUALC__ < 1400
+ #define _CRT_SECURE_NO_DEPRECATE
+ #endif
#endif
#include <stdio.h>
#include "bbgdcmvtkGetInfoGdcmReader.h"
#include "bbgdcmvtkPackage.h"
-#include "gdcmFile.h"
-#include "gdcmFileHelper.h"
-#include "vtkImageData.h"
-#include "vtkGdcmReader.h"
+#if defined USE_GDCM
+ #include "gdcmFile.h"
+ #include "gdcmFileHelper.h"
+ #include "vtkImageData.h"
+ #include "vtkGdcmReader.h"
+#endif
+#if defined USE_GDCM2
+ #include <gdcmReader.h>
+ #include <gdcmImageHelper.h>
+ #include <vtkGDCMImageReader.h>
+#endif
#include <vtkIndent.h>
namespace bbgdcmvtk
BBTK_ADD_BLACK_BOX_TO_PACKAGE(gdcmvtk,GetInfoGdcmReader)
BBTK_BLACK_BOX_IMPLEMENTATION(GetInfoGdcmReader,bbtk::AtomicBlackBox);
+
+#if defined USE_GDCM
void GetInfoGdcmReader::Process()
{
// Reset de reader, f
reader->GetOutput()->PrintSelf(std::cout, indent);
bbSetOutputOut( reader->GetOutput() );
}
+#endif
+#if defined USE_GDCM2
+void GetInfoGdcmReader::Process()
+{
+ // Reset de reader, f
+ bbUserFinalizeProcessing();
+ gdcm::Reader *read = new gdcm::Reader();
+ read->SetFileName( bbGetInputIn().c_str());
+
+ bool res = read->Read();
+ if ( !res )
+ {
+ delete read;
+ bbSetOutputOut(0);
+ return;
+ }
+
+ // Get info from THE image file (only *one* as input)
+ const gdcm::File &f = read->GetFile();
+
+ // Image Orientation (Patient)
+ int i;
+ std::vector<double> v_iop;
+ const gdcm::DataElement &deIop = f.GetDataSet().GetDataElement(gdcm::Tag(0x0020, 0x0037));
+ std::stringstream ss;
+ deIop.GetValue().Print(ss);
+ gdcm::Element<gdcm::VR::DS,gdcm::VM::VM6> iop;
+ iop.Read( ss );
+ for(i=0; i< 6; i++)
+ v_iop.push_back((float)(iop[i]));
+ bbSetOutputIOP(v_iop );
+
+ // Image Position (Patient)
+ std::vector<double> v_ipp;
+ const gdcm::DataElement &deIpp = f.GetDataSet().GetDataElement(gdcm::Tag((0x0020,0x0032)));
+ deIpp.GetValue().Print(ss);
+ gdcm::Element<gdcm::VR::DS,gdcm::VM::VM3> ipp;
+ ipp.Read( ss );
+ for(i=0; i< 3; i++)
+ v_ipp.push_back((float)(ipp[i]));
+ bbSetOutputIPP(v_ipp );
+
+ std::vector<double> v_pixelspacing = gdcm::ImageHelper::GetSpacingValue(f);
+ bbSetOutputPixelSpacing(v_pixelspacing);
+
+ //double interslice; ?? ==1 NO?
+ bbSetOutputInterSlice(v_pixelspacing[2]);
+
+ reader = vtkGDCMImageReader::New();
+ reader->SetFileName( bbGetInputIn().c_str() );
+ reader->Update();
+ reader->GetOutput();
+ vtkIndent indent ;
+ reader->GetOutput()->PrintSelf(std::cout, indent);
+ bbSetOutputOut( reader->GetOutput() );
+}
+#endif
void GetInfoGdcmReader::bbUserSetDefaultValues()
{
reader=NULL;
+#if defined USE_GDCM
f=NULL;
+#endif
bbSetInputIn("");
}
}
-
+
void GetInfoGdcmReader::bbUserFinalizeProcessing()
{
if( reader )
reader->Delete();
reader=NULL;
}
+#if defined USE_GDCM
if(f)
{
f->Delete();
f=NULL;
}
+#endif
}
-
}
+
// EO namespace bbgdcmvtk
#include "bbtkAtomicBlackBox.h"
#include "iostream"
+#if defined USE_GDCM
#include "vtkGdcmReader.h"
+#endif
+#if defined USE_GDCM2
+#include "vtkGDCMImageReader.h"
+#endif
namespace bbgdcmvtk
{
void Process();
private:
+#if defined USE_GDCM
GDCM_NAME_SPACE::File *f;
- vtkGdcmReader *reader;
+ vtkGdcmReader *reader;
+#endif
+#if defined USE_GDCM2
+ vtkGDCMImageReader *reader;
+#endif
+
+
};
//=================================================================
#include "bbgdcmvtkPackage.h"
#include "gdcmFile.h"
-#include "gdcmFileHelper.h"
#include "vtkImageData.h"
-#include "vtkGdcmReader.h"
#include <vtkIndent.h>
+#if defined USE_GDCM
+#include "gdcmFileHelper.h"
+#endif
+#if defined USE_GDCM2
+ #include <gdcmReader.h>
+ #include <gdcmImageHelper.h>
+ #include <gdcmIPPSorter.h>
+ #include <vtkGDCMImageReader.h>
+ #include "vtkStringArray.h"
+#endif
namespace bbgdcmvtk
{
BBTK_ADD_BLACK_BOX_TO_PACKAGE(gdcmvtk,GetXCoherentInfoGdcmReader)
BBTK_BLACK_BOX_IMPLEMENTATION(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
+#if defined USE_GDCM
void GetXCoherentInfoGdcmReader::Process()
{
// Read the *first* image file (a SET of file names is given as input)
bbSetOutputOut( reader->GetOutput() );
}
+#endif USE_GDCM
+
+#if defined USE_GDCM2
+void GetXCoherentInfoGdcmReader::Process()
+{
+ // Read the *first* image file (a SET of file names is given as input)
+ gdcm::Reader *read = new gdcm::Reader();
+ reader->SetFileName( bbGetInputIn()[0].c_str());
+
+ bool res = read->Read();
+ if ( !res )
+ {
+ delete read;
+ bbSetOutputOut(0);
+ return;
+ }
+
+ // Get info from the first image file
+ const gdcm::File &f = read->GetFile();
+ int i;
+ std::vector<double> v_iop;
+ const gdcm::DataElement &deIop = f.GetDataSet().GetDataElement(gdcm::Tag(0x0020, 0x0037));
+ std::stringstream ss;
+ deIop.GetValue().Print(ss);
+ gdcm::Element<gdcm::VR::DS,gdcm::VM::VM6> iop;
+ iop.Read( ss );
+ for(i=0; i< 6; i++)
+ v_iop.push_back((float)(iop[i]));
+ bbSetOutputIOP(v_iop );
+
+ std::vector<double> v_ipp;
+ const gdcm::DataElement &deIpp = f.GetDataSet().GetDataElement(gdcm::Tag((0x0020,0x0032)));
+ deIpp.GetValue().Print(ss);
+ gdcm::Element<gdcm::VR::DS,gdcm::VM::VM3> ipp;
+ ipp.Read( ss );
+ for(i=0; i< 3; i++)
+ v_ipp.push_back((float)(ipp[i]));
+ bbSetOutputIPP(v_ipp );
+
+// Add *all the files* to the IPPsorter
+ gdcm::IPPSorter s;
+ s.SetComputeZSpacing( true );
+ s.SetZSpacingTolerance( 1e-3 );
+ std::vector<std::string> gii = bbGetInputIn();
+ s.Sort(gii);
+
+ //l = sh->GetFirstSingleSerieUIDFileSet();
+ // no Test if we have multiple series
+ //s.GetFilenames();
+ //int nbFiles;
+
+ double zspacing = 0.;
+ zspacing = s.GetZSpacing();
+ std::vector<double> v_pixelspacing = gdcm::ImageHelper::GetSpacingValue(f);
+ v_pixelspacing.push_back( v_pixelspacing[0] );
+ v_pixelspacing.push_back( v_pixelspacing[1] );
+ v_pixelspacing.push_back( zspacing );
+ bbSetOutputPixelSpacing(v_pixelspacing);
+
+ if (reader!=NULL)
+ {
+ reader->Delete();
+ reader=NULL;
+ }
+ reader = vtkGDCMImageReader::New();
+ vtkStringArray *files = vtkStringArray::New();
+ std::vector< std::string >::const_iterator it = s.GetFilenames().begin();
+ for( ; it != s.GetFilenames().end(); ++it)
+ {
+ const std::string &f = *it;
+ files->InsertNextValue( f.c_str() );
+ }
+ reader->SetFileNames(files);
+ reader->Update();
+ reader->GetOutput();
+ bbSetOutputOut( reader->GetOutput() );
+}
+#endif USE_GDCM2
void GetXCoherentInfoGdcmReader::bbUserSetDefaultValues()
{
}
+#if defined USE_GDCM
void GetXCoherentInfoGdcmReader::bbUserFinalizeProcessing()
{
if(reader)
if(sh)
sh->Delete();
}
+#endif
+
+#if defined USE_GDCM2
+void GetXCoherentInfoGdcmReader::bbUserFinalizeProcessing()
+{
+ if(reader)
+ reader->Delete();
+}
+#endif
}
// EO namespace bbgdcmvtk
#include "bbgdcmvtk_EXPORT.h"
#include "bbtkAtomicBlackBox.h"
#include "iostream"
-
+#if defined(USE_GDCM)
#include "vtkGdcmReader.h"
+#endif
+
+#if defined(USE_GDCM2)
+#include "vtkGDCMImageReader.h"
+#endif
+
#include "gdcmFile.h"
#include "gdcmSerieHelper.h"
void Process();
private:
- GDCM_NAME_SPACE::File *f;
- GDCM_NAME_SPACE::SerieHelper *sh;
- vtkGdcmReader *reader;
+
+#if defined USE_GDCM
+ GDCM_NAME_SPACE::File *f;
+ GDCM_NAME_SPACE::SerieHelper *sh;
+ vtkGdcmReader *reader;
+#endif
+#if defined USE_GDCM2
+ vtkGDCMImageReader *reader;
+#endif
};
//=================================================================
# EXCEPT : the same libs than for INCLUDE_DIRS
)
#===========================================================================
-
+#===========================================================================
+# To compile with VS under x64, /bigobj flag is needed
+IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 8)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
+ENDIF()
#===========================================================================
# vtk
# ...
)
+
#===========================================================================
#===========================================================================
#===========================================================================
IF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+ IF(NOT BUILD_BBTK_PACKAGE_std)
+ # FORCE the std package to avoid compilation errors
+ SET(BUILD_BBTK_PACKAGE_std ON CACHE BOOL "Build the bbtk package ${BBTK_PACKAGE_NAME} ?" FORCE)
+ message(FATAL_ERROR "You need the std package")
+ ENDIF(NOT BUILD_BBTK_PACKAGE_std)
+
#===========================================================================
# THE USER HAS CHOSEN TO BUILD THE PACKAGE
#===========================================================================