Page MenuHomePhabricator

15618-nW.diff

15618-nW.diff

This document is not UTF8. It was detected as Shift JIS and converted to UTF8 for display.
Autor: Sarah Mang <s.mang@dkfz-heidelberg.de> 2013-07-16 09:40:54
Eintragender: Sarah Mang <s.mang@dkfz-heidelberg.de> 2013-07-16 09:40:54
Eltern: babfe9e476d019700ccea361fc232e8bf3feb539 (Merge branch 'bug-15480-add-savebasedata-in-ioutil')
Zweig: bug-15618-direct-DWI-import
Folgt auf: v2013.06.0
Vorg舅ger von:
find out if dataset is DWI
TODO: start diffusionReader
-------------------- Core/Code/IO/mitkDicomSeriesReader.cpp --------------------
index 4a0c865..429c0a8 100644
@@ -29,8 +29,10 @@ See LICENSE.txt or http://www.mitk.org for details.
#include <gdcmDirectory.h>
#include <gdcmScanner.h>
#include <gdcmUIDs.h>
+#include <gdcmDataSet.h>
#include "mitkProperties.h"
+#include <mitkCoreObjectFactory.h>
namespace mitk
{
@@ -555,6 +557,66 @@ DicomSeriesReader::LoadDicomSeries(
return false;
}
+ bool
+ DicomSeriesReader::IsDWI(const std::string &filename)
+ {
+ //initialize reading the header information. Look if b-value tags exist to determine if DWI.
+ gdcm::Reader reader;
+ reader.SetFileName(filename.c_str());
+ reader.Read();
+ const gdcm::File &f = reader.GetFile();
+ const gdcm::DataSet &data_set = f.GetDataSet();
+ gdcm::StringFilter sf;
+ sf.SetFile(reader.GetFile());
+ //Look at recommended dicom Tags from supplement 49
+ gdcm::Tag bvalue(0x0018,0x9087);
+ //Look at vendor specific dicom Tags
+ //GE: (0043,1039) : Slop_int_6
+ gdcm::Tag bvalueGE(0x0043,0x1039);
+ //Siemens: (0029,1010)
+ gdcm::Tag bvalueSiemensOld(0x0043,0x1039);
+ gdcm::Tag bvalueSiemens(0x0019,0x100C);
+ //Philips: (2001,1003)
+ gdcm::Tag bvaluePhilips(0x2001,0x1003);
+
+ gdcm::Tag refTag;
+ gdcm::DataSet::ConstIterator it = data_set.Begin();
+ int count = 0;
+ for(; it != data_set.End(); ++it)
+ {
+ const gdcm::DataElement &ref = *it;
+ refTag = ref.GetTag();
+ if (refTag == bvalue)
+ {
+ MITK_INFO<<"is general DWI";
+ return true;
+ }
+ if (refTag == bvalueGE)
+ {
+ MITK_INFO<<"is GE DWI";
+ return true;
+ }
+ if (refTag == bvalueSiemensOld)
+ {
+ MITK_INFO<<"is Siemens DWI";
+ return true;
+ }
+ if (refTag == bvalueSiemens)
+ {
+ MITK_INFO<<"is Siemens DWI";
+ return true;
+ }
+ if (refTag == bvaluePhilips)
+ {
+ MITK_INFO<<"is Philips DWI";
+ return true;
+ }
+ ++count;
+ }
+ MITK_INFO<<"is no DWI";
+ return false;
+ }
+
bool
DicomSeriesReader::IsDicom(const std::string &filename)
@@ -1307,6 +1369,19 @@ DicomSeriesReader::GetSeries(const StringContainer& files, bool sortTo3DPlust, b
if ( std::string(fileIter->first).empty() ) continue; // TODO understand why Scanner has empty string entries
if ( std::string(fileIter->first) == std::string("DICOMDIR") ) continue;
+ if( IsDWI(fileIter->first) ){
+ MITK_INFO<<"This is a DWI data set!";
+ //check if Dicom-DWI import is active
+ mitk::CoreObjectFactory::GetInstance()->GetFileExtensions();
+ std::multimap<std::string, std::string> fileExtensionMap = mitk::CoreObjectFactory::GetInstance()->GetFileExtensionsMap();
+ //look for ".dwi"
+ std::string key = "*.dwi";
+ //if active start this dicom reader
+ if (fileExtensionMap.find(key) != fileExtensionMap.end()){
+ MITK_INFO<<"Start DWI import";
+ }
+ }
+
/* sort out multi-frame
if ( scanner.GetValue( fileIter->first , tagNumberOfFrames ) )
{
--------------------- Core/Code/IO/mitkDicomSeriesReader.h ---------------------
index d45f874..8c88df5 100644
@@ -459,6 +459,10 @@ public:
IsDicom(const std::string &filename);
/**
+ \brief DWI image(s) or not
+ */
+ static bool IsDWI(const std::string &filename);
+ /**
\brief see other GetSeries().
Find all series (and sub-series -- see details) in a particular directory.

File Metadata

Mime Type
application/octet-stream
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
985

Event Timeline

diff off previous patch without white space changes