#include "bbTransform3DdicomMetaImageReader_DicomInfo.h" #include "bbTransform3DdicomPackage.h" namespace bbTransform3Ddicom { BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,MetaImageReader_DicomInfo) BBTK_BLACK_BOX_IMPLEMENTATION(MetaImageReader_DicomInfo,bbtk::AtomicBlackBox); void MetaImageReader_DicomInfo::Process() { if (bbGetInputIn()!=""){ IPP.clear(); IOP.clear(); PixelSpacing.clear(); char tmp[100]; FILE *ff = fopen( bbGetInputIn().c_str() , "r+" ); fscanf(ff,"%s", tmp); // ImagePositionPatient fscanf(ff,"%s", tmp); // x IPP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // y IPP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // z IPP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // ImageOrientationPatient fscanf(ff,"%s", tmp); // x1 IOP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // y1 IOP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // z1 IOP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // x2 IOP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // y2 IOP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // z2 IOP.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // Spacing fscanf(ff,"%s", tmp); // sx PixelSpacing.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // sy PixelSpacing.push_back( atof(tmp) ); fscanf(ff,"%s", tmp); // sz PixelSpacing.push_back( atof(tmp) ); fclose(ff); bbSetOutputIPP( IPP ); bbSetOutputIOP( IPP ); bbSetOutputPixelSpacing( PixelSpacing ); } } /* void MetaImageReader_DicomInfo::bbUserConstructor() { bbSetInputIn(""); IPP.clear(); IOP.clear(); IOP.push_back( 1 ); // x1 IOP.push_back( 0 ); // y1 IOP.push_back( 0 ); // z1 IOP.push_back( 0 ); // x2 IOP.push_back(10 ); // y2 IOP.push_back( 0 ); // z2 PixelSpacing.clear(); PixelSpacing.push_back( 1 ); PixelSpacing.push_back( 1 ); PixelSpacing.push_back( 1 ); } void MetaImageReader_DicomInfo::bbUserCopyConstructor(bbtk::BlackBox::Pointer) { } void MetaImageReader_DicomInfo::bbUserDestructor() { } */ //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MetaImageReader_DicomInfo::bbUserSetDefaultValues() { bbSetInputIn(""); IPP.clear(); IOP.clear(); IOP.push_back( 1 ); // x1 IOP.push_back( 0 ); // y1 IOP.push_back( 0 ); // z1 IOP.push_back( 0 ); // x2 IOP.push_back(10 ); // y2 IOP.push_back( 0 ); // z2 PixelSpacing.clear(); PixelSpacing.push_back( 1 ); PixelSpacing.push_back( 1 ); PixelSpacing.push_back( 1 ); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MetaImageReader_DicomInfo::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MetaImageReader_DicomInfo::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbTransform3Ddicom