From 5c4ad551cce5b49d6e6878b3b3e58a653f4bf550 Mon Sep 17 00:00:00 2001 From: Romain Garrigues <romain.garrigues@c-s.fr> Date: Wed, 28 Jun 2006 15:51:09 +0000 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20ITK=20version=202.8.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utilities/ITK/Utilities/MetaIO/CMakeLists.txt | 9 +- Utilities/ITK/Utilities/MetaIO/metaArrow.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaArrow.h | 6 +- Utilities/ITK/Utilities/MetaIO/metaBlob.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaBlob.h | 6 +- .../ITK/Utilities/MetaIO/metaCommand.cxx | 422 +++++++++- Utilities/ITK/Utilities/MetaIO/metaCommand.h | 83 +- .../ITK/Utilities/MetaIO/metaContour.cxx | 771 ++++++++++++++++++ Utilities/ITK/Utilities/MetaIO/metaContour.h | 169 ++++ .../ITK/Utilities/MetaIO/metaDTITube.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaDTITube.h | 6 +- .../ITK/Utilities/MetaIO/metaEllipse.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaEllipse.h | 6 +- .../ITK/Utilities/MetaIO/metaGaussian.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaGaussian.h | 6 +- Utilities/ITK/Utilities/MetaIO/metaGroup.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaGroup.h | 6 +- Utilities/ITK/Utilities/MetaIO/metaITKUtils.h | 12 +- Utilities/ITK/Utilities/MetaIO/metaImage.cxx | 112 ++- Utilities/ITK/Utilities/MetaIO/metaImage.h | 52 +- .../ITK/Utilities/MetaIO/metaImageUtils.cxx | 2 +- .../ITK/Utilities/MetaIO/metaImageUtils.h | 2 +- .../ITK/Utilities/MetaIO/metaLandmark.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaLandmark.h | 6 +- Utilities/ITK/Utilities/MetaIO/metaLine.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaLine.h | 6 +- Utilities/ITK/Utilities/MetaIO/metaMesh.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaMesh.h | 6 +- Utilities/ITK/Utilities/MetaIO/metaObject.cxx | 95 ++- Utilities/ITK/Utilities/MetaIO/metaObject.h | 42 +- Utilities/ITK/Utilities/MetaIO/metaScene.cxx | 48 +- Utilities/ITK/Utilities/MetaIO/metaScene.h | 6 +- .../ITK/Utilities/MetaIO/metaSurface.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaSurface.h | 6 +- .../ITK/Utilities/MetaIO/metaTransform.cxx | 6 +- .../ITK/Utilities/MetaIO/metaTransform.h | 6 +- Utilities/ITK/Utilities/MetaIO/metaTube.cxx | 6 +- Utilities/ITK/Utilities/MetaIO/metaTube.h | 6 +- .../ITK/Utilities/MetaIO/metaTubeGraph.cxx | 6 +- .../ITK/Utilities/MetaIO/metaTubeGraph.h | 6 +- Utilities/ITK/Utilities/MetaIO/metaTypes.h | 28 +- Utilities/ITK/Utilities/MetaIO/metaUtils.cxx | 27 +- Utilities/ITK/Utilities/MetaIO/metaUtils.h | 11 +- .../ITK/Utilities/MetaIO/metaVesselTube.cxx | 6 +- .../ITK/Utilities/MetaIO/metaVesselTube.h | 6 +- .../ITK/Utilities/MetaIO/tests/CMakeLists.txt | 5 +- 46 files changed, 1861 insertions(+), 203 deletions(-) create mode 100644 Utilities/ITK/Utilities/MetaIO/metaContour.cxx create mode 100644 Utilities/ITK/Utilities/MetaIO/metaContour.h diff --git a/Utilities/ITK/Utilities/MetaIO/CMakeLists.txt b/Utilities/ITK/Utilities/MetaIO/CMakeLists.txt index e1f1185ab4..b6b988064b 100644 --- a/Utilities/ITK/Utilities/MetaIO/CMakeLists.txt +++ b/Utilities/ITK/Utilities/MetaIO/CMakeLists.txt @@ -3,6 +3,8 @@ ADD_LIBRARY(ITKMetaIO metaBlob.cxx metaCommand.h metaCommand.cxx + metaContour.h + metaContour.cxx metaDTITube.cxx metaEllipse.cxx metaGroup.cxx @@ -26,6 +28,9 @@ ADD_LIBRARY(ITKMetaIO #SUBDIRS(tests) -INSTALL_TARGETS(/lib/otb ITKMetaIO) -INSTALL_FILES(/include/otb/Utilities/ITK/Utilities/MetaIO "(\\.h)$") +IF(ITK_LIBRARY_PROPERTIES) + SET_TARGET_PROPERTIES(ITKMetaIO PROPERTIES ${ITK_LIBRARY_PROPERTIES}) +ENDIF(ITK_LIBRARY_PROPERTIES) +INSTALL_TARGETS(/lib/InsightToolkit ITKMetaIO) +INSTALL_FILES(/include/InsightToolkit/Utilities/MetaIO "(\\.h)$") TARGET_LINK_LIBRARIES(ITKMetaIO ${ITK_ZLIB_LIBRARIES}) diff --git a/Utilities/ITK/Utilities/MetaIO/metaArrow.cxx b/Utilities/ITK/Utilities/MetaIO/metaArrow.cxx index fa87acb1b7..cf0ade2a86 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaArrow.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaArrow.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaArrow.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaArrow.h" // // Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaArrow.h b/Utilities/ITK/Utilities/MetaIO/metaArrow.h index 9f93ec379d..a41dcee488 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaArrow.h +++ b/Utilities/ITK/Utilities/MetaIO/metaArrow.h @@ -1,9 +1,9 @@ #ifndef METAArrow_H #define METAArrow_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaBlob.cxx b/Utilities/ITK/Utilities/MetaIO/metaBlob.cxx index f31122c686..4ecfd5c6c9 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaBlob.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaBlob.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaBlob.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaBlob.h" // // MedImage Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaBlob.h b/Utilities/ITK/Utilities/MetaIO/metaBlob.h index 63d5aa9998..98f049a933 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaBlob.h +++ b/Utilities/ITK/Utilities/MetaIO/metaBlob.h @@ -1,9 +1,9 @@ #ifndef METABLOB_H #define METABLOB_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaCommand.cxx b/Utilities/ITK/Utilities/MetaIO/metaCommand.cxx index 86c9b2e4e2..a3f3ff775b 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaCommand.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaCommand.cxx @@ -3,8 +3,8 @@ Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: metaCommand.cxx,v $ Language: C++ - Date: $Date: 2006/01/01 17:31:45 $ - Version: $Revision: 1.13 $ + Date: $Date: 2006/05/19 18:15:22 $ + Version: $Revision: 1.15 $ Copyright (c) 2002 Insight Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. @@ -17,6 +17,7 @@ #include "metaCommand.h" #include <stdio.h> #include <string> +#include <fstream> MetaCommand::MetaCommand() { @@ -24,11 +25,14 @@ MetaCommand::MetaCommand() m_OptionVector.clear(); m_Version = "Not defined"; m_Date = "Not defined"; + m_Name = ""; + m_Author = "Not defined"; + m_Description = ""; m_ParsedOptionVector.clear(); } -/** Extract the date from the $Date: 2006/01/01 17:31:45 $ cvs command */ +/** Extract the date from the $Date: 2006/05/19 18:15:22 $ cvs command */ std::string MetaCommand::ExtractDateFromCVS(std::string date) { std::string newdate; @@ -99,12 +103,21 @@ bool MetaCommand::SetOption(std::string name, // Create a field without description as a flag Field field; - field.name = name; - field.externaldata = false; + if(type == LIST) + { + field.name = "NumberOfValues"; + } + else + { + field.name = name; + } + field.externaldata = DATA_NONE; field.type = type; field.value = defVal; field.userDefined = false; field.required = true; + field.rangeMin = ""; + field.rangeMax = ""; option.fields.push_back(field); m_OptionVector.push_back(option); @@ -116,7 +129,9 @@ bool MetaCommand::SetOption(std::string name, bool MetaCommand::AddField(std::string name, std::string description, TypeEnumType type, - bool externalData) + DataEnumType externalData, + std::string rangeMin, + std::string rangeMax) { // need to add some tests here to check if the option is not defined yet Option option; @@ -129,6 +144,8 @@ bool MetaCommand::AddField(std::string name, field.required = true; field.userDefined = false; field.externaldata = externalData; + field.rangeMin = rangeMin; + field.rangeMax = rangeMax; option.fields.push_back(field); option.required = true; @@ -165,7 +182,9 @@ bool MetaCommand::AddOptionField(std::string optionName, TypeEnumType type, bool required, std::string defVal, - std::string description) + std::string description, + DataEnumType externalData + ) { OptionVector::iterator it = m_OptionVector.begin(); while(it != m_OptionVector.end()) @@ -180,7 +199,9 @@ bool MetaCommand::AddOptionField(std::string optionName, field.value = defVal; field.description = description; field.userDefined = false; - field.externaldata = false; + field.externaldata = externalData; + field.rangeMin = ""; + field.rangeMax = ""; // If this is the first field in the list we replace the current field if((*it).fields[0].type == FLAG) @@ -198,6 +219,36 @@ bool MetaCommand::AddOptionField(std::string optionName, return false; } +/** Set the range of an option */ +bool MetaCommand::SetOptionRange(std::string optionName, + std::string name, + std::string rangeMin, + std::string rangeMax) +{ + OptionVector::iterator it = m_OptionVector.begin(); + while(it != m_OptionVector.end()) + { + if((*it).name == optionName) + { + std::vector<Field> & fields = (*it).fields; + std::vector<Field>::iterator itField = fields.begin(); + while(itField != fields.end()) + { + if((*itField).name == name) + { + (*itField).rangeMin = rangeMin; + (*itField).rangeMax = rangeMax; + return true; + } + itField++; + } + } + it++; + } + return false; +} + + /** Return the value of the option as a boolean */ bool MetaCommand::GetValueAsBool(std::string optionName,std::string fieldName) { @@ -365,8 +416,6 @@ int MetaCommand::GetValueAsInt(Option option,std::string fieldName) return 0; } - - /** Return the value of the option as a string */ std::string MetaCommand::GetValueAsString(std::string optionName, std::string fieldName) @@ -464,12 +513,12 @@ GetOptionWasSet(Option option) bool MetaCommand:: GetOptionWasSet( std::string optionName) { - OptionVector::const_iterator it = m_OptionVector.begin(); - while(it != m_OptionVector.end()) + OptionVector::const_iterator it = m_ParsedOptionVector.begin(); + while(it != m_ParsedOptionVector.end()) { if((*it).name == optionName) { - return this->GetOptionWasSet(*it); + return true; } it++; } @@ -669,11 +718,18 @@ bool MetaCommand::ParseXML(const char* buffer) field.type = this->StringToType(this->GetXML(f.c_str(),"type",0).c_str()); if(atoi(this->GetXML(f.c_str(),"external",0).c_str()) == 0) { - field.externaldata = false; + field.externaldata = DATA_NONE; } else { - field.externaldata = true; + if(atoi(this->GetXML(f.c_str(),"external",0).c_str()) == 1) + { + field.externaldata = DATA_IN; + } + else + { + field.externaldata = DATA_OUT; + } } if(atoi(this->GetXML(f.c_str(),"required",0).c_str()) == 0) { @@ -859,11 +915,253 @@ MetaCommand::GetOptionId(Option* option) return -1; } +/** Export the current command line arguments to a Grid Application + * Description file */ +bool MetaCommand::ExportGAD(bool dynamic) +{ + std::cout << "Exporting GAD file..."; + + OptionVector options = m_OptionVector; + if(dynamic) + { + options = m_ParsedOptionVector; + } + + if(m_Name=="") + { + std::cout << "Set the name of the application using SetName()" << std::endl; + return false; + } + + std::string filename = m_Name; + filename += ".gad.xml"; + + std::ofstream file; + file.open(filename.c_str(), std::ios::binary | std::ios::out); + if(!file.is_open()) + { + std::cout << "Cannot open file for writing: " << filename.c_str() << std::endl; + return false; + } + + file << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" << std::endl; + file << "<GridApplication" << std::endl; + file << "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" << std::endl; + file << "xsi:noNamespaceSchemaLocation=\"grid-application-description.xsd\"" << std::endl; + file << "Name=\"" << m_Name.c_str() << "\"" << std::endl; + file << "Description=\"" << m_Description.c_str() << "\">" << std::endl; + file << "<ApplicationComponent Name=\"Client\" RemoteExecution=\"true\">" << std::endl; + file << "<ComponentActionList>" << std::endl; + file << std::endl; + + unsigned int order = 1; + // Write out the input data to be transfered + OptionVector::const_iterator it = options.begin(); + while(it != options.end()) + { + std::vector<Field>::const_iterator itFields = (*it).fields.begin(); + while(itFields != (*it).fields.end()) + { + if((*itFields).externaldata == DATA_IN) + { + file << " <ComponentAction Type=\"DataRelocation\" Order=\"" << order << "\">" << std::endl; + file << " <parameter Name=\"Name\" Value=\"" << (*itFields).name <<"\"/>" << std::endl; + file << " <parameter Name=\"Host\" Value=\"hostname\"/>" << std::endl; + file << " <parameter Name=\"Description\" Value=\"" << (*itFields).description << "\"/>" << std::endl; + file << " <parameter Name=\"Direction\" Value=\"In\"/>" << std::endl; + file << " <parameter Name=\"Protocol\" Value=\"gsiftp\"/>" << std::endl; + file << " <parameter Name=\"SourceDataPath\" Value=\"" << (*itFields).value << "\"/>" << std::endl; + + std::string datapath = (*itFields).value; + long int slash = datapath.find_last_of("/"); + if(slash>0) + { + datapath = datapath.substr(slash+1,datapath.size()-slash-1); + } + slash = datapath.find_last_of("\\"); + if(slash>0) + { + datapath = datapath.substr(slash+1,datapath.size()-slash-1); + } + file << " <parameter Name=\"DestDataPath\" Value=\"" << datapath.c_str() << "\"/>" << std::endl; + file << " </ComponentAction>" << std::endl; + file << std::endl; + order++; + } + itFields++; + } + it++; + } + + file << " <ComponentAction Type=\"JobSubmission\" Order=\"" << order << "\">" << std::endl; + file << " <parameter Name=\"Executable\" Value=\"" << m_ExecutableName.c_str() << "\"/>" << std::endl; + file << " <parameter Name=\"Arguments\" Value=\""; + // Write out the command line arguments + it = options.begin(); + while(it != options.end()) + { + if(it != options.begin()) + { + file << " "; + } + file << "{" << (*it).name.c_str() << "}"; + it++; + } + file << "\"/>" << std::endl; + + file << " <arguments>" << std::endl; + // Write out the arguments that are not data + it = options.begin(); + while(it != options.end()) + { + // Find if this is a non data field + bool isData = false; + std::vector<Field>::const_iterator itFields = (*it).fields.begin(); + while(itFields != (*it).fields.end()) + { + if((*itFields).externaldata != DATA_NONE) + { + isData = true; + break; + } + itFields++; + } + + if(isData) + { + it++; + continue; + } + + file << " <group Name=\"" << (*it).name.c_str(); + file << "\" Syntax=\""; + + if((*it).tag.size()>0) + { + file << "-" << (*it).tag.c_str() << " "; + } + + itFields = (*it).fields.begin(); + while(itFields != (*it).fields.end()) + { + if(itFields != (*it).fields.begin()) + { + file << " "; + } + file << "{" << (*it).name << (*itFields).name << "}"; + itFields++; + } + file << "\""; + + if(!(*it).required) + { + file << " Optional=\"true\""; + + // Add if the option was selected + if((*it).userDefined) + { + file << " Selected=\"true\""; + } + else + { + file << " Selected=\"false\""; + } + } + + file << ">" << std::endl; + + // Now writes the value of the arguments + itFields = (*it).fields.begin(); + while(itFields != (*it).fields.end()) + { + file << " <argument Name=\"" << (*it).name << (*itFields).name; + file << "\" Value=\"" << (*itFields).value; + file << "\" Type=\"" << this->TypeToString((*itFields).type).c_str(); + file << "\""; + + if((*itFields).rangeMin != "") + { + file << " RangeMin=\"" << (*itFields).rangeMin << "\""; + } + + if((*itFields).rangeMax != "") + { + file << " RangeMax=\"" << (*itFields).rangeMax << "\""; + } + file << "/>" << std::endl; + itFields++; + } + file << " </group>" << std::endl; + it++; + } + file << " </arguments>" << std::endl; + file << " </ComponentAction>" << std::endl; + order++; + file << std::endl; + // Write out the input data to be transfered + it = options.begin(); + while(it != options.end()) + { + std::vector<Field>::const_iterator itFields = (*it).fields.begin(); + while(itFields != (*it).fields.end()) + { + if((*itFields).externaldata == DATA_OUT) + { + file << " <ComponentAction Type=\"DataRelocation\" Order=\"" << order << "\">" << std::endl; + file << " <parameter Name=\"Name\" Value=\"" << (*itFields).name <<"\"/>" << std::endl; + file << " <parameter Name=\"Host\" Value=\"hostname\"/>" << std::endl; + file << " <parameter Name=\"Description\" Value=\"" << (*itFields).description << "\"/>" << std::endl; + file << " <parameter Name=\"Direction\" Value=\"Out\"/>" << std::endl; + file << " <parameter Name=\"Protocol\" Value=\"gsiftp\"/>" << std::endl; + std::string datapath = (*itFields).value; + long int slash = datapath.find_last_of("/"); + if(slash>0) + { + datapath = datapath.substr(slash+1,datapath.size()-slash-1); + } + slash = datapath.find_last_of("\\"); + if(slash>0) + { + datapath = datapath.substr(slash+1,datapath.size()-slash-1); + } + file << " <parameter Name=\"SourceDataPath\" Value=\"" << datapath.c_str() << "\"/>" << std::endl; + file << " <parameter Name=\"DestDataPath\" Value=\"" << (*itFields).value << "\"/>" << std::endl; + file << " </ComponentAction>" << std::endl; + file << std::endl; + order++; + } + itFields++; + } + it++; + } + file << std::endl; + file << " </ComponentActionList>" << std::endl; + file << " </ApplicationComponent>" << std::endl; + file << "</GridApplication>" << std::endl; + + file.close(); + + std::cout << "done" << std::endl; + return true; +} /** Parse the command line */ bool MetaCommand::Parse(int argc, char* argv[]) { + m_ExecutableName = argv[0]; + + long int slash = m_ExecutableName.find_last_of("/"); + if(slash>0) + { + m_ExecutableName = m_ExecutableName.substr(slash+1,m_ExecutableName.size()-slash-1); + } + slash = m_ExecutableName.find_last_of("\\"); + if(slash>0) + { + m_ExecutableName = m_ExecutableName.substr(slash+1,m_ExecutableName.size()-slash-1); + } + // List the options if using -V if((argc == 2 && !strcmp(argv[1],"-V")) || (argc == 2 && !strcmp(argv[1],"-H"))) @@ -895,6 +1193,11 @@ bool MetaCommand::Parse(int argc, char* argv[]) std::cout << "Date: " << m_Date.c_str() << std::endl; return false; } + else if(argc == 2 && !strcmp(argv[1],"-exportGAD")) + { + this->ExportGAD(); + return false; + } // Fill in the results m_ParsedOptionVector.clear(); @@ -908,11 +1211,20 @@ bool MetaCommand::Parse(int argc, char* argv[]) bool isComplete = false; // check if the option should be parse until the next tag is found std::string completeString = ""; + bool exportGAD = false; + for(unsigned int i=1;i<(unsigned int)argc;i++) { + // If we have the tag -export-gad + if(!strcmp(argv[i],"-exportGAD")) + { + exportGAD = true; + continue; + } + // If this is a tag if(argv[i][0] == '-' && (atof(argv[i])==0)) - { + { // if we have a tag before the expected values we throw an exception if(valuesRemaining!=0) { @@ -959,10 +1271,12 @@ bool MetaCommand::Parse(int argc, char* argv[]) } else if(m_OptionVector[currentOption].fields[0].type == LIST) { - inArgument = true; - valuesRemaining = (int)atoi(argv[++i]); + inArgument = true; + unsigned int valuesInList = (int)atoi(argv[++i]); + m_OptionVector[currentOption].fields[0].value = argv[i]; + valuesRemaining += valuesInList-1; char optName[255]; - for(unsigned int j=0; j<valuesRemaining; j++) + for(unsigned int j=0; j<valuesInList; j++) { sprintf(optName, "%03d", j); this->AddOptionField( m_OptionVector[currentOption].name, @@ -1038,7 +1352,7 @@ bool MetaCommand::Parse(int argc, char* argv[]) } if(valuesRemaining == 0) - { + { inArgument = false; m_OptionVector[currentOption].userDefined = true; m_ParsedOptionVector.push_back(m_OptionVector[currentOption]); @@ -1053,7 +1367,9 @@ bool MetaCommand::Parse(int argc, char* argv[]) std::cout << "Options: " << std::endl << " -v or -h for help listed in short format" << std::endl << " -V or -H for help listed in long format" << std::endl - << " -vxml for help listed in xml format" << std::endl; + << " -vxml for help listed in xml format" << std::endl + << " -export-gad to export Grid Application" + << "Description file format" << std::endl; return false; } @@ -1065,6 +1381,16 @@ bool MetaCommand::Parse(int argc, char* argv[]) { if((*it).required) { + // First check if the option is actually defined + if(!(*it).userDefined) + { + std::cout << "Option " << (*it).name + << " is required but not defined" << std::endl; + requiredAndNotDefined = true; + it++; + continue; + } + // Check if the values are defined std::vector<Field>::const_iterator itFields = (*it).fields.begin(); bool defined = true; @@ -1101,10 +1427,60 @@ bool MetaCommand::Parse(int argc, char* argv[]) << "Options: " << std::endl << " -v or -h for help listed in short format" << std::endl << " -V or -H for help listed in long format" << std::endl - << " -vxml for help listed in xml format" << std::endl; + << " -vxml for help listed in xml format" << std::endl + << " -export-gad to export Grid Application" + << "Description file format" << std::endl; return false; } + // Check if the values are in range (if the range is defined) + OptionVector::iterator itParsed = m_ParsedOptionVector.begin(); + bool valueInRange = true; + while(itParsed != m_ParsedOptionVector.end()) + { + std::vector<Field>::const_iterator itFields = (*itParsed).fields.begin(); + while(itFields != (*itParsed).fields.end()) + { + // Check only if this is a number + if(((*itFields).type == INT || + (*itFields).type == FLOAT || + (*itFields).type == CHAR) + && ((*itFields).value != "") + ) + { + // Check the range min + if( + (((*itFields).rangeMin != "") + && (atof((*itFields).rangeMin.c_str())>atof((*itFields).value.c_str()))) + || + (((*itFields).rangeMax != "") + && (atof((*itFields).rangeMax.c_str())<atof((*itFields).value.c_str()))) + ) + { + std::cout << (*itParsed).name << "." << (*itFields).name + << " : Value (" << (*itFields).value << ") " + << "is not in the range [" << (*itFields).rangeMin + << "," << (*itFields).rangeMax << "]" << std::endl; + valueInRange = false; + } + } + itFields++; + } + itParsed++; + } + + if(!valueInRange) + { + return false; + } + + // If everything is ok + if(exportGAD) + { + this->ExportGAD(true); + return false; // prevent from running the application + } + return true; } @@ -1123,6 +1499,8 @@ std::string MetaCommand::TypeToString(TypeEnumType type) return "list"; case FLAG: return "flag"; + case BOOL: + return "boolean"; default: return "not defined"; } diff --git a/Utilities/ITK/Utilities/MetaIO/metaCommand.h b/Utilities/ITK/Utilities/MetaIO/metaCommand.h index 645a8ec94b..36f1ad4590 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaCommand.h +++ b/Utilities/ITK/Utilities/MetaIO/metaCommand.h @@ -3,8 +3,8 @@ Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: metaCommand.h,v $ Language: C++ - Date: $Date: 2006/01/01 17:31:45 $ - Version: $Revision: 1.7 $ + Date: $Date: 2006/05/18 14:38:56 $ + Version: $Revision: 1.8 $ Copyright (c) 2002 Insight Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. @@ -33,26 +33,29 @@ class MetaCommand public: - typedef enum {INT,FLOAT,CHAR,STRING,LIST,FLAG} TypeEnumType; + typedef enum {DATA_NONE,DATA_IN,DATA_OUT} DataEnumType; + typedef enum {INT,FLOAT,CHAR,STRING,LIST,FLAG,BOOL} TypeEnumType; struct Field{ - std::string name; - std::string description; - std::string value; + std::string name; + std::string description; + std::string value; TypeEnumType type; - bool externaldata; - bool required; - bool userDefined; + DataEnumType externaldata; + std::string rangeMin; + std::string rangeMax; + bool required; + bool userDefined; }; struct Option{ - std::string name; - std::string description; - std::string tag; + std::string name; + std::string description; + std::string tag; std::vector<Field> fields; - bool required; - bool userDefined; - bool complete; + bool required; + bool userDefined; + bool complete; }; typedef std::vector<Option> OptionVector; @@ -77,7 +80,28 @@ public: bool AddField(std::string name, std::string description, TypeEnumType type, - bool externalData); + DataEnumType externalData = DATA_NONE, + std::string rangeMin = "", + std::string rangeMax = "" + ); + + /** For backward compatibility */ + bool AddField(std::string name, + std::string description, + TypeEnumType type, + bool externalData + ) + { + if(externalData) + { + return this->AddField(name,description,type,DATA_IN); + } + else + { + return this->AddField(name,description,type,DATA_NONE); + } + } + /** Add a field to an option */ bool AddOptionField(std::string optionName, @@ -85,8 +109,16 @@ public: TypeEnumType type, bool required=true, std::string defVal = "", - std::string description = ""); + std::string description = "", + DataEnumType externalData = DATA_NONE); + /** Set the range of value as an option */ + bool SetOptionRange(std::string optionName, + std::string name, + std::string rangeMin, + std::string rangeMax); + + /** Collect all the information until the next tag * \warning this function works only if the field is of type String */ void SetOptionComplete(std::string optionName, @@ -126,6 +158,10 @@ public: /** Given an XML buffer fill in the command line arguments */ bool ParseXML(const char* buffer); + /** Export the current command line arguments to a Grid Application + * Description file */ + bool ExportGAD(bool dynamic=false); + /** Extract the date from cvs date */ std::string ExtractDateFromCVS(std::string date); @@ -143,6 +179,15 @@ public: void SetDate(const char* date) { m_Date=date; } + void SetName(const char* name) + { m_Name=name; } + + void SetDescription(const char* description) + { m_Description=description; } + + void SetAuthor(const char* author) + { m_Author=author; } + long GetOptionId(Option* option); /** Return the list of options */ @@ -166,6 +211,10 @@ protected: std::string m_Version; std::string m_Date; + std::string m_Name; + std::string m_Description; + std::string m_Author; + std::string m_ExecutableName; private: diff --git a/Utilities/ITK/Utilities/MetaIO/metaContour.cxx b/Utilities/ITK/Utilities/MetaIO/metaContour.cxx new file mode 100644 index 0000000000..1b1a1f4257 --- /dev/null +++ b/Utilities/ITK/Utilities/MetaIO/metaContour.cxx @@ -0,0 +1,771 @@ +#include <stdio.h> +#include <ctype.h> +#include <iostream> +#include <fstream> +#include <string> + +#include <metaUtils.h> +#include <metaObject.h> +#include <metaContour.h> + +/** Constructor */ +MetaContour:: +MetaContour() +:MetaObject() +{ + if(META_DEBUG) std::cout << "MetaContour()" << std::endl; + Clear(); +} + +/** Constructor */ +MetaContour:: +MetaContour(const char *_headerName) +:MetaObject() +{ + if(META_DEBUG) std::cout << "MetaContour()" << std::endl; + Clear(); + Read(_headerName); +} + +// +MetaContour:: +MetaContour(const MetaContour *_Contour) +:MetaObject() +{ + if(META_DEBUG) std::cout << "MetaContour()" << std::endl; + Clear(); + CopyInfo(_Contour); +} + + + +// +MetaContour:: +MetaContour(unsigned int dim) +:MetaObject(dim) +{ + if(META_DEBUG) std::cout << "MetaContour()" << std::endl; + Clear(); +} + +// +MetaContour:: +~MetaContour() +{ + Clear(); + M_Destroy(); +} + +// +void MetaContour:: +PrintInfo() const +{ + MetaObject::PrintInfo(); + std::cout << "ControlPointDim = " << m_ControlPointDim << std::endl; + std::cout << "NControlPoints = " << m_NControlPoints << std::endl; + std::cout << "InterpolatedPointDim = " << m_InterpolatedPointDim << std::endl; + std::cout << "NInterpolatedPoints = " << m_NInterpolatedPoints << std::endl; + std::cout << "Display Orientation = " << m_DisplayOrientation << std::endl; + std::cout << "Attached to Slice = " << m_AttachedToSlice << std::endl; +} + +void MetaContour:: +CopyInfo(const MetaContour * _Contour) +{ + MetaObject::CopyInfo(_Contour); +} + +void MetaContour:: +Closed(bool close) +{ + m_Closed = close; +} + +bool MetaContour +::Closed() +{ + return m_Closed; +} + + +void MetaContour:: +ControlPointDim(const char* pointDim) +{ + strcpy(m_ControlPointDim,pointDim); +} + +const char* MetaContour:: +ControlPointDim(void) const +{ + return m_ControlPointDim; +} + +void MetaContour:: +InterpolatedPointDim(const char* pointDim) +{ + strcpy(m_InterpolatedPointDim,pointDim); +} + +const char* MetaContour:: +InterpolatedPointDim(void) const +{ + return m_InterpolatedPointDim; +} + +int MetaContour:: +NControlPoints(void) const +{ + return m_NControlPoints; +} + +int MetaContour:: +NInterpolatedPoints(void) const +{ + return m_NInterpolatedPoints; +} + + +MET_InterpolationEnumType +MetaContour::Interpolation(void) const +{ + return m_InterpolationType; +} + +void MetaContour::Interpolation(MET_InterpolationEnumType _interpolation) +{ + m_InterpolationType = _interpolation; +} + + +/** Clear Contour information */ +void MetaContour:: +Clear(void) +{ + if(META_DEBUG) std::cout << "MetaContour: Clear" << std::endl; + MetaObject::Clear(); + m_InterpolationType = MET_NO_INTERPOLATION; + m_NControlPoints = 0; + m_NInterpolatedPoints = 0; + + // Delete the list of control points. + ControlPointListType::iterator it = m_ControlPointsList.begin(); + while(it != m_ControlPointsList.end()) + { + ContourControlPnt* pnt = *it; + it++; + delete pnt; + } + m_ControlPointsList.clear(); + + // Delete the list of interpolated points + InterpolatedPointListType::iterator itInterpolated = m_InterpolatedPointsList.begin(); + while(itInterpolated != m_InterpolatedPointsList.end()) + { + ContourInterpolatedPnt* pnt = *itInterpolated; + itInterpolated++; + delete pnt; + } + m_InterpolatedPointsList.clear(); + + strcpy(m_ControlPointDim, "id x y z xp yp zp nx ny nz r g b a"); + strcpy(m_InterpolatedPointDim, "id x y z r g b a"); + m_Closed = false; + m_DisplayOrientation = -1; + m_AttachedToSlice = -1; +} + +/** Destroy Contour information */ +void MetaContour:: +M_Destroy(void) +{ + MetaObject::M_Destroy(); +} + +/** Set if the contour is pinned to a particulare slice */ +void MetaContour:: +AttachedToSlice(long int slice) +{ + m_AttachedToSlice = slice; +} + +/** Get if the contour is pinned to a particulare slice */ +long int MetaContour:: +AttachedToSlice() +{ + return m_AttachedToSlice; +} + +/** Get the orientation of the display */ +void MetaContour:: +DisplayOrientation(int display) +{ + m_DisplayOrientation = display; +} + +int MetaContour:: +DisplayOrientation() +{ + return m_DisplayOrientation; +} + +/** Set Read fields */ +void MetaContour:: +M_SetupReadFields(void) +{ + if(META_DEBUG) std::cout << "MetaContour: M_SetupReadFields" << std::endl; + + MetaObject::M_SetupReadFields(); + + MET_FieldRecordType * mF; + + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "Closed", MET_INT, true); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "PinToSlice", MET_INT, false); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "DisplayOrientation", MET_INT, false); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "ControlPointDim", MET_STRING, true); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "NControlPoints", MET_INT, true); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "ControlPoints", MET_NONE, true); + mF->terminateRead = true; + m_Fields.push_back(mF); +} + +void MetaContour:: +M_SetupWriteFields(void) +{ + if(META_DEBUG) std::cout << "MetaContour: M_SetupWriteFields" << std::endl; + + strcpy(m_ObjectTypeName,"Contour"); + MetaObject::M_SetupWriteFields(); + + MET_FieldRecordType * mF; + + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "Closed", MET_INT, m_Closed); + m_Fields.push_back(mF); + + if(m_AttachedToSlice != -1) + { + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "PinToSlice", MET_INT, m_AttachedToSlice); + m_Fields.push_back(mF); + } + + if(m_DisplayOrientation != -1) + { + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "DisplayOrientation", MET_INT, m_DisplayOrientation); + m_Fields.push_back(mF); + } + + if(strlen(m_ControlPointDim)>0) + { + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "ControlPointDim", MET_STRING, + strlen(m_ControlPointDim),m_ControlPointDim); + m_Fields.push_back(mF); + } + + m_NControlPoints = m_ControlPointsList.size(); + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "NControlPoints", MET_INT,m_NControlPoints); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "ControlPoints", MET_NONE); + m_Fields.push_back(mF); +} + + +bool MetaContour:: +M_Read(void) +{ + if(META_DEBUG) std::cout << "MetaContour: M_Read: Loading Header" << std::endl; + + if(!MetaObject::M_Read()) + { + std::cout << "MetaContour: M_Read: Error parsing file" << std::endl; + return false; + } + + if(META_DEBUG) std::cout << "MetaContour: M_Read: Parsing Header" << std::endl; + + MET_FieldRecordType * mF; + + mF = MET_GetFieldRecord("Closed", &m_Fields); + if(mF->defined) + { + if(mF->value[0]) + { + m_Closed = true; + } + } + + mF = MET_GetFieldRecord("DisplayOrientation", &m_Fields); + if(mF->defined) + { + if(mF->value[0]) + { + m_DisplayOrientation = (int)mF->value[0]; + } + } + + mF = MET_GetFieldRecord("PinToSlice", &m_Fields); + if(mF->defined) + { + if(mF->value[0]) + { + m_AttachedToSlice = (long int)mF->value[0]; + } + } + + mF = MET_GetFieldRecord("NControlPoints", &m_Fields); + if(mF->defined) + { + m_NControlPoints= (int)mF->value[0]; + } + + mF = MET_GetFieldRecord("ControlPointDim", &m_Fields); + if(mF->defined) + { + strcpy(m_ControlPointDim,(char *)(mF->value)); + } + + int pntDim; + char** pntVal = NULL; + MET_StringToWordArray(m_ControlPointDim, &pntDim, &pntVal); + + int i; + for(i=0;i<pntDim;i++) + { + delete [] pntVal[i]; + } + delete [] pntVal; + + float v[16]; + + if(m_BinaryData) + { + int readSize = m_NControlPoints*pntDim*4; + + char* _data = new char[readSize]; + m_ReadStream->read((char *)_data, readSize); + + int gc = m_ReadStream->gcount(); + if(gc != readSize) + { + std::cout << "MetaContour: m_Read: data not read completely" + << std::endl; + std::cout << " ideal = " << readSize << " : actual = " << gc << std::endl; + return false; + } + + i=0; + int d; + double td; + for(int j=0; j<m_NControlPoints; j++) + { + ContourControlPnt* pnt = new ContourControlPnt(m_NDims); + + MET_ValueToDouble(MET_FLOAT, _data, i++, &td); + pnt->m_Id = (unsigned long)td; + + for(d=0; d<m_NDims; d++) + { + MET_ValueToDouble(MET_FLOAT, _data, i++, &td); + pnt->m_X[d] = (float)td; + } + + for(d=0; d<m_NDims; d++) + { + MET_ValueToDouble(MET_FLOAT, _data, i++, &td); + pnt->m_XPicked[d] = (float)td; + } + + for(d=0; d<m_NDims; d++) + { + MET_ValueToDouble(MET_FLOAT, _data, i++, &td); + pnt->m_V[d] = (float)td; + } + + for(d=0; d<4; d++) + { + MET_ValueToDouble(MET_FLOAT, _data, i++, &td); + pnt->m_Color[d] = (float)td; + } + m_ControlPointsList.push_back(pnt); + } + delete [] _data; + } + else + { + for(int j=0; j<m_NControlPoints; j++) + { + ContourControlPnt* pnt = new ContourControlPnt(m_NDims); + + for(int k=0; k<pntDim; k++) + { + *m_ReadStream >> v[k]; + m_ReadStream->get(); // char c = + } + + unsigned long pos = 0; + pnt->m_Id = (unsigned long)v[pos]; + pos++; + + int d; + for(d=0; d<m_NDims; d++) + { + pnt->m_X[d] = v[pos]; + pos++; + } + + for(d=0; d<m_NDims; d++) + { + pnt->m_XPicked[d] = v[pos]; + pos++; + } + + for(d=0; d<m_NDims; d++) + { + pnt->m_V[d] = v[pos]; + pos++; + } + + for(d=0; d<4; d++) + { + pnt->m_Color[d] = v[pos]; + pos++; + } + + m_ControlPointsList.push_back(pnt); + } + + char c = ' '; + while( (c!='\n') && (!m_ReadStream->eof())) + { + c = m_ReadStream->get();// to avoid unrecognize charactere + } + } + + // Read the interpolated point + this->ClearFields(); + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "Interpolation", MET_STRING, true); + mF->terminateRead = true; + m_Fields.push_back(mF); + MET_Read(*m_ReadStream,&m_Fields,'=',false,false); + + mF = MET_GetFieldRecord("Interpolation", &m_Fields); + if(mF && mF->defined) + { + MET_StringToInterpolationType((char *)mF->value, &m_InterpolationType); + } + + // Only read points if explicit interpolation + if(m_InterpolationType == MET_EXPLICIT_INTERPOLATION) + { + this->ClearFields(); + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "InterpolatedPointDim", MET_STRING, true); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "NInterpolatedPoints", MET_INT, true); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "InterpolatedPoints", MET_NONE, true); + mF->terminateRead = true; + m_Fields.push_back(mF); + + MET_Read(*m_ReadStream,&m_Fields); + + mF = MET_GetFieldRecord("NInterpolatedPoints", &m_Fields); + if(mF->defined) + { + m_NInterpolatedPoints= (int)mF->value[0]; + } + + mF = MET_GetFieldRecord("InterpolatedPointDim", &m_Fields); + if(mF->defined) + { + strcpy(m_InterpolatedPointDim,(char *)(mF->value)); + } + + int pntDim; + char** pntVal = NULL; + MET_StringToWordArray(m_InterpolatedPointDim, &pntDim, &pntVal); + + int i; + for(i=0;i<pntDim;i++) + { + delete [] pntVal[i]; + } + delete [] pntVal; + + float v[16]; + + if(m_BinaryData) + { + int readSize = m_NInterpolatedPoints*pntDim*4; + + char* _data = new char[readSize]; + m_ReadStream->read((char *)_data, readSize); + + int gc = m_ReadStream->gcount(); + if(gc != readSize) + { + std::cout << "MetaContour: m_Read: data not read completely" + << std::endl; + std::cout << " ideal = " << readSize << " : actual = " << gc << std::endl; + return false; + } + + i=0; + int d; + double td; + for(int j=0; j<m_NInterpolatedPoints; j++) + { + ContourInterpolatedPnt* pnt = new ContourInterpolatedPnt(m_NDims); + + MET_ValueToDouble(MET_FLOAT, _data, i++, &td); + pnt->m_Id = (unsigned long)td; + + for(d=0; d<m_NDims; d++) + { + MET_ValueToDouble(MET_FLOAT, _data, i++, &td); + pnt->m_X[d] = (float)td; + } + + for(d=0; d<4; d++) + { + MET_ValueToDouble(MET_FLOAT, _data, i++, &td); + pnt->m_Color[d] = (float)td; + } + m_InterpolatedPointsList.push_back(pnt); + } + delete [] _data; + } + else + { + for(int j=0; j<m_NInterpolatedPoints; j++) + { + ContourInterpolatedPnt* pnt = new ContourInterpolatedPnt(m_NDims); + + for(int k=0; k<pntDim; k++) + { + *m_ReadStream >> v[k]; + m_ReadStream->get(); // char c = + } + + unsigned long pos = 0; + pnt->m_Id = (unsigned long)v[pos]; + pos++; + + int d; + for(d=0; d<m_NDims; d++) + { + pnt->m_X[d] = v[pos]; + pos++; + } + + for(d=0; d<4; d++) + { + pnt->m_Color[d] = v[pos]; + pos++; + } + + m_InterpolatedPointsList.push_back(pnt); + } + + char c = ' '; + while( (c!='\n') && (!m_ReadStream->eof())) + { + c = m_ReadStream->get();// to avoid unrecognize charactere + } + } + } + + return true; +} + + +bool MetaContour:: +M_Write(void) +{ + if(META_DEBUG) std::cout << "MetaContour: M_Write" << std::endl; + + if(!MetaObject::M_Write()) + { + std::cout << "MetaContour: M_Read: Error parsing file" << std::endl; + return false; + } + + /** Then write the control points */ + if(m_BinaryData) + { + ControlPointListType::const_iterator it = m_ControlPointsList.begin(); + + char* data = new char[(m_NDims*3+5)*m_NControlPoints*4]; + int i=0; + int d; + while(it != m_ControlPointsList.end()) + { + MET_DoubleToValue((double)(*it)->m_Id,MET_FLOAT,data,i++); + + for(d = 0; d < m_NDims; d++) + { + MET_DoubleToValue((double)(*it)->m_X[d],MET_FLOAT,data,i++); + } + + for(d = 0; d < m_NDims; d++) + { + MET_DoubleToValue((double)(*it)->m_XPicked[d],MET_FLOAT,data,i++); + } + + for(d = 0; d < m_NDims; d++) + { + MET_DoubleToValue((double)(*it)->m_V[d],MET_FLOAT,data,i++); + } + + for(d=0; d<4; d++) + { + MET_DoubleToValue((double)(*it)->m_Color[d],MET_FLOAT,data,i++); + } + it++; + } + + m_WriteStream->write((char *)data,(m_NDims*3+5)*m_NControlPoints*4); + m_WriteStream->write("\n",1); + delete [] data; + } + else + { + ControlPointListType::const_iterator it = m_ControlPointsList.begin(); + + int d; + while(it != m_ControlPointsList.end()) + { + *m_WriteStream << (*it)->m_Id << " "; + + for(d = 0; d < m_NDims; d++) + { + *m_WriteStream << (*it)->m_X[d] << " "; + } + + for(d = 0; d < m_NDims; d++) + { + *m_WriteStream << (*it)->m_XPicked[d] << " "; + } + + for(d = 0; d < m_NDims; d++) + { + *m_WriteStream << (*it)->m_V[d] << " "; + } + + for(d=0;d<4;d++) + { + *m_WriteStream << (*it)->m_Color[d] << " "; + } + *m_WriteStream << std::endl; + it++; + } + } + + this->ClearFields(); + MET_FieldRecordType * mF; + + if(m_InterpolationType != MET_NO_INTERPOLATION) + { + char s[255]; + mF = new MET_FieldRecordType; + strcpy(s, MET_InterpolationTypeName[m_InterpolationType]); + MET_InitWriteField(mF, "Interpolation", MET_STRING, strlen(s), s); + m_Fields.push_back(mF); + } + + m_NInterpolatedPoints = m_InterpolatedPointsList.size(); + if(m_NInterpolatedPoints>0) + { + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "InterpolatedPointDim", MET_STRING, + strlen(m_InterpolatedPointDim),m_InterpolatedPointDim); + m_Fields.push_back(mF); + + m_NInterpolatedPoints = m_InterpolatedPointsList.size(); + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "NInterpolatedPoints", MET_INT,m_NInterpolatedPoints); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "InterpolatedPoints", MET_NONE); + m_Fields.push_back(mF); + } + + MET_Write(*m_WriteStream,&m_Fields); + + if(m_BinaryData) + { + InterpolatedPointListType::const_iterator it = m_InterpolatedPointsList.begin(); + + char* data = new char[(m_NDims+5)*m_NInterpolatedPoints*4]; + int i=0; + int d; + while(it != m_InterpolatedPointsList.end()) + { + MET_DoubleToValue((double)(*it)->m_Id,MET_FLOAT,data,i++); + + for(d = 0; d < m_NDims; d++) + { + MET_DoubleToValue((double)(*it)->m_X[d],MET_FLOAT,data,i++); + } + for(d=0; d<4; d++) + { + MET_DoubleToValue((double)(*it)->m_Color[d],MET_FLOAT,data,i++); + } + it++; + } + + m_WriteStream->write((char *)data,(m_NDims+5)*m_NInterpolatedPoints*4); + m_WriteStream->write("\n",1); + delete [] data; + } + else + { + InterpolatedPointListType::const_iterator it = m_InterpolatedPointsList.begin(); + + int d; + while(it != m_InterpolatedPointsList.end()) + { + *m_WriteStream << (*it)->m_Id << " "; + + for(d = 0; d < m_NDims; d++) + { + *m_WriteStream << (*it)->m_X[d] << " "; + } + + for(d=0;d<4;d++) + { + *m_WriteStream << (*it)->m_Color[d] << " "; + } + *m_WriteStream << std::endl; + it++; + } + } + return true; +} diff --git a/Utilities/ITK/Utilities/MetaIO/metaContour.h b/Utilities/ITK/Utilities/MetaIO/metaContour.h new file mode 100644 index 0000000000..2ae859b644 --- /dev/null +++ b/Utilities/ITK/Utilities/MetaIO/metaContour.h @@ -0,0 +1,169 @@ +#ifndef METAContour_H +#define METAContour_H + +#include <metaTypes.h> +#include <metaUtils.h> +#include <metaObject.h> + +#include <list> + + +/** + * Description: + * Reads and Writes MetaContour Files. + * + * \author Julien Jomier + * + * \date March 2006 + * + */ +class ContourControlPnt +{ +public: + + ContourControlPnt(int dim) + { + m_Id = 0; + m_Dim = dim; + m_X = new float[m_Dim]; + m_XPicked = new float[m_Dim]; + m_V = new float[m_Dim]; + for(unsigned int i=0;i<m_Dim;i++) + { + m_X[i] = 0; + m_XPicked[i] = 0; + m_V[i] = 0; + } + //Color is red by default + m_Color[0]=1.0; + m_Color[1]=0.0; + m_Color[2]=0.0; + m_Color[3]=1.0; + } + ~ContourControlPnt() + { + delete [] m_X; + delete [] m_XPicked; + delete [] m_V; + }; + + unsigned int m_Dim; + unsigned long m_Id; + float* m_X; + float* m_XPicked; + float* m_V; + float m_Color[4]; +}; + + +class ContourInterpolatedPnt +{ +public: + + ContourInterpolatedPnt(int dim) + { + m_Dim = dim; + m_Id = 0; + m_X = new float[m_Dim]; + //Color is red by default + m_Color[0]=1.0; + m_Color[1]=0.0; + m_Color[2]=0.0; + m_Color[3]=1.0; + } + + ~ContourInterpolatedPnt() + { + delete []m_X; + }; + + unsigned int m_Dim; + float* m_X; + unsigned long m_Id; + float m_Color[4]; +}; + + +class MetaContour : public MetaObject +{ + +public: + + typedef std::list<ContourControlPnt*> ControlPointListType; + typedef std::list<ContourInterpolatedPnt*> InterpolatedPointListType; + + MetaContour(void); + MetaContour(const char *_headerName); + MetaContour(const MetaContour *_Contour); + MetaContour(unsigned int dim); + + ~MetaContour(void); + + void PrintInfo(void) const; + void CopyInfo(const MetaContour * _Contour); + + // NPoints(...) + // Required Field + // Number of points wich compose the tube + int NControlPoints(void) const; + + // ControlPointDim(...) + // Required Field + // Definition of points + void ControlPointDim(const char* pointDim); + const char* ControlPointDim(void) const; + + MET_InterpolationEnumType Interpolation(void) const; + void Interpolation(MET_InterpolationEnumType _interpolation); + + int NInterpolatedPoints(void) const; + + void InterpolatedPointDim(const char* pointDim); + const char* InterpolatedPointDim(void) const; + + void Closed(bool close); + bool Closed(); + + void AttachedToSlice(long int slice); + long int AttachedToSlice(); + + void DisplayOrientation(int display); + int DisplayOrientation(); + + void Clear(void); + + ControlPointListType & GetControlPoints(void) + {return m_ControlPointsList;} + const ControlPointListType & GetControlPoints(void) const + {return m_ControlPointsList;} + + InterpolatedPointListType & GetInterpolatedPoints(void) + {return m_InterpolatedPointsList;} + const InterpolatedPointListType & GetInterpolatedPoints(void) const + {return m_InterpolatedPointsList;} + +protected: + + bool m_ElementByteOrderMSB; + void M_Destroy(void); + void M_SetupReadFields(void); + void M_SetupWriteFields(void); + bool M_Read(void); + bool M_Write(void); + + int m_NControlPoints; + int m_NInterpolatedPoints; + char m_ControlPointDim[255]; + char m_InterpolatedPointDim[255]; + bool m_Closed; + MET_InterpolationEnumType m_InterpolationType; + ControlPointListType m_ControlPointsList; + InterpolatedPointListType m_InterpolatedPointsList; + + int m_DisplayOrientation; + long m_AttachedToSlice; + +}; + + +#endif diff --git a/Utilities/ITK/Utilities/MetaIO/metaDTITube.cxx b/Utilities/ITK/Utilities/MetaIO/metaDTITube.cxx index e544c04d73..85d2f89720 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaDTITube.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaDTITube.cxx @@ -8,9 +8,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaDTITube.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaDTITube.h" /** MetaDTITube Constructors */ MetaDTITube:: diff --git a/Utilities/ITK/Utilities/MetaIO/metaDTITube.h b/Utilities/ITK/Utilities/MetaIO/metaDTITube.h index 8c2dcd8559..5827712843 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaDTITube.h +++ b/Utilities/ITK/Utilities/MetaIO/metaDTITube.h @@ -5,9 +5,9 @@ #pragma warning ( disable : 4786 ) #endif -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaEllipse.cxx b/Utilities/ITK/Utilities/MetaIO/metaEllipse.cxx index eb004a7275..77fd87bcf6 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaEllipse.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaEllipse.cxx @@ -5,9 +5,9 @@ #include <string> #include <string.h> // for memset -#include <metaUtils.h> -#include <metaObject.h> -#include <metaEllipse.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaEllipse.h" // // MedImage Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaEllipse.h b/Utilities/ITK/Utilities/MetaIO/metaEllipse.h index 6c614f71cd..a7fe3b8a5e 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaEllipse.h +++ b/Utilities/ITK/Utilities/MetaIO/metaEllipse.h @@ -1,9 +1,9 @@ #ifndef METAEllipse_H #define METAEllipse_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaGaussian.cxx b/Utilities/ITK/Utilities/MetaIO/metaGaussian.cxx index d9d9e729c6..e83b3fa0ae 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaGaussian.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaGaussian.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaGaussian.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaGaussian.h" // // MedImage Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaGaussian.h b/Utilities/ITK/Utilities/MetaIO/metaGaussian.h index 5708f5ed04..2a5c663291 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaGaussian.h +++ b/Utilities/ITK/Utilities/MetaIO/metaGaussian.h @@ -1,9 +1,9 @@ #ifndef METAGaussian_H #define METAGaussian_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaGroup.cxx b/Utilities/ITK/Utilities/MetaIO/metaGroup.cxx index 3311cc2fcd..9aca7d8f65 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaGroup.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaGroup.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaGroup.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaGroup.h" // // MedImage Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaGroup.h b/Utilities/ITK/Utilities/MetaIO/metaGroup.h index 952e46bb0f..09c14af6a0 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaGroup.h +++ b/Utilities/ITK/Utilities/MetaIO/metaGroup.h @@ -1,9 +1,9 @@ #ifndef METAGroup_H #define METAGroup_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaITKUtils.h b/Utilities/ITK/Utilities/MetaIO/metaITKUtils.h index 1e6b267262..a701929603 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaITKUtils.h +++ b/Utilities/ITK/Utilities/MetaIO/metaITKUtils.h @@ -3,8 +3,8 @@ Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: metaITKUtils.h,v $ Language: C++ - Date: $Date: 2003/09/10 14:30:12 $ - Version: $Revision: 1.4 $ + Date: $Date: 2006/03/15 11:18:39 $ + Version: $Revision: 1.5 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. @@ -20,10 +20,10 @@ #ifndef META_ITK_UTILS_H #define META_ITK_UTILS_H -#include<metaImage.h> -#include<itkImage.h> -#include<itkProcessObject.h> -#include<itkImageRegionIterator.h> +#include "metaImage.h" +#include "itkImage.h" +#include "itkProcessObject.h" +#include "itkImageRegionIterator.h" template <class T> diff --git a/Utilities/ITK/Utilities/MetaIO/metaImage.cxx b/Utilities/ITK/Utilities/MetaIO/metaImage.cxx index b8d407d099..4d1cf47c01 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaImage.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaImage.cxx @@ -7,10 +7,11 @@ #include <math.h> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaImage.h> -#include <zlib.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaImage.h" + +#include "zlib.h" // // MetaImage Constructors @@ -205,6 +206,12 @@ PrintInfo() const std::cout << "Min and Max are not valid" << std::endl; } + std::cout << "ElementToIntensityFunctionSlope = " + << m_ElementToIntensityFunctionSlope << std::endl; + std::cout << "ElementToIntensityFunctionOffset = " + << m_ElementToIntensityFunctionOffset << std::endl; + + std::cout << "AutoFreeElementData = " << ((m_AutoFreeElementData)?"True":"False") << std::endl; @@ -226,6 +233,8 @@ CopyInfo(const MetaImage * _im) SequenceID(_im->SequenceID()); ElementMin(_im->ElementMin()); ElementMax(_im->ElementMax()); + ElementToIntensityFunctionSlope(_im->ElementToIntensityFunctionSlope()); + ElementToIntensityFunctionOffset(_im->ElementToIntensityFunctionOffset()); } int MetaImage:: @@ -503,6 +512,30 @@ ElementMax(double _elementMax) m_ElementMax = _elementMax; } +double MetaImage:: +ElementToIntensityFunctionSlope(void) const + { + return m_ElementToIntensityFunctionSlope; + } + +void MetaImage:: +ElementToIntensityFunctionSlope(double _elementToIntensityFunctionSlope) + { + m_ElementToIntensityFunctionSlope = _elementToIntensityFunctionSlope; + } + +double MetaImage:: +ElementToIntensityFunctionOffset(void) const + { + return m_ElementToIntensityFunctionOffset; + } + +void MetaImage:: +ElementToIntensityFunctionOffset(double _elementOffset) + { + m_ElementToIntensityFunctionOffset = _elementOffset; + } + bool MetaImage:: ConvertElementDataTo(MET_ValueEnumType _elementType, double _toMin, double _toMax) @@ -539,6 +572,40 @@ ConvertElementDataTo(MET_ValueEnumType _elementType, return true; } +bool MetaImage:: +ConvertElementDataToIntensityData(MET_ValueEnumType _elementType) + { + ElementByteOrderFix(); + if(!ElementMinMaxValid()) + { + ElementMinMaxRecalc(); + } + + double toMin = m_ElementMin + m_ElementToIntensityFunctionOffset; + double toMax = (m_ElementMax-m_ElementMin) + * m_ElementToIntensityFunctionSlope + + m_ElementMin; + + return ConvertElementDataTo(_elementType, toMin, toMax); + } + +bool MetaImage:: +ConvertIntensityDataToElementData(MET_ValueEnumType _elementType) + { + ElementByteOrderFix(); + if(!ElementMinMaxValid()) + { + ElementMinMaxRecalc(); + } + + double toMin = m_ElementMin - m_ElementToIntensityFunctionOffset; + double toMax = (m_ElementMax - m_ElementMin) + / m_ElementToIntensityFunctionSlope + + toMin; + + return ConvertElementDataTo(_elementType, toMin, toMax); + } + void * MetaImage:: ElementData(void) { @@ -1153,6 +1220,9 @@ Clear(void) m_SubQuantity[0] = 0; m_DimSize[0] = 0; + m_ElementToIntensityFunctionSlope = 1; + m_ElementToIntensityFunctionOffset = 0; + MetaObject::Clear(); m_BinaryData = true; @@ -1298,6 +1368,14 @@ M_SetupReadFields(void) MET_InitReadField(mF, "ElementNBits", MET_INT, false); m_Fields.push_back(mF); + mF = new MET_FieldRecordType; // Used by ConvertElementToIntensity funcs + MET_InitReadField(mF, "ElementToIntensityFunctionSlope", MET_FLOAT, false); + m_Fields.push_back(mF); + + mF = new MET_FieldRecordType; // Used by ConvertElementToIntensity funcs + MET_InitReadField(mF, "ElementToIntensityFunctionOffset", MET_FLOAT, false); + m_Fields.push_back(mF); + mF = new MET_FieldRecordType; MET_InitReadField(mF, "ElementType", MET_STRING, true); mF->required = true; @@ -1395,6 +1473,19 @@ M_SetupWriteFields(void) m_Fields.push_back(mF); } + if(m_ElementToIntensityFunctionSlope != 1 || + m_ElementToIntensityFunctionOffset != 0) + { + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "ElementToIntensityFunctionSlope", + MET_FLOAT, m_ElementToIntensityFunctionSlope); + m_Fields.push_back(mF); + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "ElementToIntensityFunctionOffset", + MET_FLOAT, m_ElementToIntensityFunctionOffset); + m_Fields.push_back(mF); + } + mF = new MET_FieldRecordType; MET_TypeToString(m_ElementType, s); MET_InitWriteField(mF, "ElementType", MET_STRING, strlen(s), s); @@ -1707,6 +1798,19 @@ M_Read(void) } } + m_ElementToIntensityFunctionSlope = 1; + m_ElementToIntensityFunctionOffset = 0; + mF = MET_GetFieldRecord("ElementToIntensityFunctionSlope", &m_Fields); + if(mF && mF->defined) + { + m_ElementToIntensityFunctionSlope = mF->value[0]; + } + mF = MET_GetFieldRecord("ElementToIntensityFunctionOffset", &m_Fields); + if(mF && mF->defined) + { + m_ElementToIntensityFunctionOffset = mF->value[0]; + } + mF = MET_GetFieldRecord("ElementType", &m_Fields); if(mF && mF->defined) { diff --git a/Utilities/ITK/Utilities/MetaIO/metaImage.h b/Utilities/ITK/Utilities/MetaIO/metaImage.h index a1206d9db5..3bb5233664 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaImage.h +++ b/Utilities/ITK/Utilities/MetaIO/metaImage.h @@ -1,12 +1,12 @@ #ifndef METAIMAGE_H #define METAIMAGE_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" -#include <metaImageTypes.h> -#include <metaImageUtils.h> +#include "metaImageTypes.h" +#include "metaImageUtils.h" /*! MetaImage (.h and .cpp) * @@ -14,20 +14,26 @@ * Reads and Writes MetaImageFiles. * MetaImageFiles can be in one of two possible formats: * a combined header/data format, typically designated .mha files - * or as separate header and data files, typically designated .mhd and .mda files + * or as separate header and data files, typically designated + * .mhd and .mda files * * Features: - * Header information is in ascii format - for easy creation, editing, and review. - * If separate files are used, a specified number of header-bytes in the datafile can be skipped - * - in this manner, different file formats (e.g., bmp, img, and /usr/Image) can - * be converted to metaImageFile format by merely specifying a separate text header - * (.mhd) file and in that file specifying how many data-header-bytes should be skipped. - * Thereby the data files can serve a dual role (as bitmap files and as metaImage data files) + * Header information is in ascii format - for easy creation, editing, + * and review. If separate files are used, a specified number of + * header-bytes in the datafile can be skipped + * - in this manner, different file formats (e.g., bmp, img, + * and /usr/Image) can be converted to metaImageFile format by + * merely specifying a separate text header (.mhd) file and in that + * file specifying how many data-header-bytes should be skipped. + * Thereby the data files can serve a dual role (as bitmap files + * and as metaImage data files) * Supports all pixel formats * Handles byte ordering (MSB/LSB) - * Provides the ability to handle associated medical image information (element size, element spacing, etc). - * Has required and optional header data (provides rapid formation or extensive documentation). - * REQUIRED: NDims, DimSize, ByteOrderMSB, DataFileName + * Provides the ability to handle associated medical image + * information (element size, element spacing, etc). + * Has required and optional header data (provides rapid formation + * or extensive documentation). + * REQUIRED: NDims, DimSize, ByteOrderMSB, ElementDataType, DataFileName * * \author Stephen R. Aylward * @@ -68,6 +74,9 @@ class MetaImage : public MetaObject double m_ElementMin; double m_ElementMax; + double m_ElementToIntensityFunctionSlope; + double m_ElementToIntensityFunctionOffset; + bool m_AutoFreeElementData; void * m_ElementData; @@ -209,11 +218,20 @@ class MetaImage : public MetaObject double ElementMax(void) const; void ElementMax(double _elementMax); + double ElementToIntensityFunctionSlope(void) const; + void ElementToIntensityFunctionSlope(double _slope); + double ElementToIntensityFunctionOffset(void) const; + void ElementToIntensityFunctionOffset(double _offset); + // ConverTo(...) // Converts to a new data type // Rescales using Min and Max (see above) - bool ConvertElementDataTo(MET_ValueEnumType _elementType=MET_UCHAR, - double _toMin=0, double _toMax=0); + bool ConvertElementDataTo(MET_ValueEnumType _elementType=MET_USHORT, + double _toMin=0, double _toMax=0); + bool ConvertElementDataToIntensityData( + MET_ValueEnumType _intensityType=MET_SHORT); + bool ConvertIntensityDataToElementData( + MET_ValueEnumType _elementType=MET_USHORT); // // diff --git a/Utilities/ITK/Utilities/MetaIO/metaImageUtils.cxx b/Utilities/ITK/Utilities/MetaIO/metaImageUtils.cxx index bdcd5c2c78..61fbead7b3 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaImageUtils.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaImageUtils.cxx @@ -3,7 +3,7 @@ #include <stdio.h> #include <string.h> -#include <metaImageTypes.h> +#include "metaImageTypes.h" bool MET_StringToImageModality(const char * _str, MET_ImageModalityEnumType * _type) diff --git a/Utilities/ITK/Utilities/MetaIO/metaImageUtils.h b/Utilities/ITK/Utilities/MetaIO/metaImageUtils.h index fff37c2985..eefef23c63 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaImageUtils.h +++ b/Utilities/ITK/Utilities/MetaIO/metaImageUtils.h @@ -1,7 +1,7 @@ #ifndef METAIMAGEUTILS_H #define METAIMAGEUTILS_H -#include <metaImageTypes.h> +#include "metaImageTypes.h" extern bool MET_StringToImageModality(const char * _str, MET_ImageModalityEnumType * _type); diff --git a/Utilities/ITK/Utilities/MetaIO/metaLandmark.cxx b/Utilities/ITK/Utilities/MetaIO/metaLandmark.cxx index eb7fe674e2..f04a83dc89 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaLandmark.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaLandmark.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaLandmark.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaLandmark.h" // // MedImage Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaLandmark.h b/Utilities/ITK/Utilities/MetaIO/metaLandmark.h index 27df1429bd..3d5f04a814 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaLandmark.h +++ b/Utilities/ITK/Utilities/MetaIO/metaLandmark.h @@ -1,9 +1,9 @@ #ifndef METALANDMARK_H #define METALANDMARK_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaLine.cxx b/Utilities/ITK/Utilities/MetaIO/metaLine.cxx index d1e27f82d8..ccb159a99f 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaLine.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaLine.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaLine.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaLine.h" // // MetaLine Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaLine.h b/Utilities/ITK/Utilities/MetaIO/metaLine.h index cf8fc10c09..abac5ef26b 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaLine.h +++ b/Utilities/ITK/Utilities/MetaIO/metaLine.h @@ -1,9 +1,9 @@ #ifndef METALINE_H #define METALINE_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaMesh.cxx b/Utilities/ITK/Utilities/MetaIO/metaMesh.cxx index d7a4014517..bc1206d6c0 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaMesh.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaMesh.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaMesh.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaMesh.h" // // MetaMesh Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaMesh.h b/Utilities/ITK/Utilities/MetaIO/metaMesh.h index 63bb3367be..42e0d8631b 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaMesh.h +++ b/Utilities/ITK/Utilities/MetaIO/metaMesh.h @@ -1,9 +1,9 @@ #ifndef METAMESH_H #define METAMESH_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaObject.cxx b/Utilities/ITK/Utilities/MetaIO/metaObject.cxx index 3f8cb18656..8bd1bf23e1 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaObject.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaObject.cxx @@ -6,8 +6,8 @@ #include <math.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaUtils.h" +#include "metaObject.h" int META_DEBUG = 0; // @@ -25,6 +25,7 @@ MetaObject(void) m_FileName[0] = '\0'; m_Event = NULL; m_DoublePrecision = 6; + m_DistanceUnits = MET_DISTANCE_UNITS_UNKNOWN; } MetaObject:: @@ -39,6 +40,7 @@ MetaObject(const char * _fileName) this->Read(_fileName); m_Event = NULL; m_DoublePrecision = 6; + m_DistanceUnits = MET_DISTANCE_UNITS_UNKNOWN; } MetaObject:: @@ -54,6 +56,7 @@ MetaObject(unsigned int dim) InitializeEssential(dim); m_Event = NULL; m_DoublePrecision = 6; + m_DistanceUnits = MET_DISTANCE_UNITS_UNKNOWN; } @@ -212,6 +215,7 @@ CopyInfo(const MetaObject * _object) Name(_object->Name()); BinaryData(_object->BinaryData()); BinaryDataByteOrderMSB(_object->BinaryDataByteOrderMSB()); + DistanceUnits(_object->DistanceUnits()); } bool MetaObject:: @@ -289,9 +293,9 @@ Write(const char *_fileName) M_SetupWriteFields(); if(!m_WriteStream) - { + { m_WriteStream = new std::ofstream; - } + } #ifdef __sgi // Create the file. This is required on some older sgi's @@ -300,9 +304,9 @@ Write(const char *_fileName) #endif m_WriteStream->open(m_FileName,std::ios::binary | std::ios::out); if(!m_WriteStream->is_open()) - { + { return false; - } + } bool result = M_Write(); @@ -329,18 +333,30 @@ PrintInfo(void) const std::cout << "ID = " << m_ID << std::endl; std::cout << "ParentID = " << m_ParentID << std::endl; if(m_CompressedData) + { std::cout << "CompressedData = True" << std::endl; + } else + { std::cout << "CompressedData = False" << std::endl; + } std::cout << "m_CompressedDataSize = " << m_CompressedDataSize << std::endl; if(m_BinaryData) + { std::cout << "BinaryData = True" << std::endl; + } else + { std::cout << "BinaryData = False" << std::endl; + } if(m_BinaryData && m_BinaryDataByteOrderMSB) + { std::cout << "BinaryDataByteOrderMSB = True" << std::endl; + } else + { std::cout << "BinaryDataByteOrderMSB = False" << std::endl; + } std::cout << "Color = " ; for(i=0; i<4; i++) { @@ -381,6 +397,7 @@ PrintInfo(void) const } std::cout << std::endl; + std::cout << "DistanceUnits = " << this->DistanceUnitsName() << std::endl; // Print User's fields : FieldsContainerType::const_iterator itw = m_UserDefinedWriteFields.begin(); @@ -696,6 +713,45 @@ CenterOfRotation(int _i, double _value) m_CenterOfRotation[_i] = _value; } +// +const char * MetaObject:: +DistanceUnitsName(void) const + { + return (const char *)(MET_DistanceUnitsTypeName[m_DistanceUnits]); + } + +MET_DistanceUnitsEnumType MetaObject:: +DistanceUnits(void) const + { + return m_DistanceUnits; + } + +void MetaObject:: +DistanceUnits(MET_DistanceUnitsEnumType _distanceUnits) + { + m_DistanceUnits = _distanceUnits; + } + +void MetaObject:: +DistanceUnits(const char * _distanceUnits) + { + int i; + bool found = false; + for(i=0; i<MET_NUM_DISTANCE_UNITS_TYPES; i++) + { + if(!strcmp(_distanceUnits, MET_DistanceUnitsTypeName[i])) + { + m_DistanceUnits = static_cast<MET_DistanceUnitsEnumType>(i); + found = true; + break; + } + } + if(!found) + { + m_DistanceUnits = MET_DISTANCE_UNITS_UNKNOWN; + } + } + // // const char * MetaObject:: @@ -928,6 +984,8 @@ Clear(void) m_CompressedData = false; m_WriteCompressedDataSize = true; + m_DistanceUnits = MET_DISTANCE_UNITS_UNKNOWN; + if(META_DEBUG) { std::cout << "MetaObject: Clear: m_NDims=" << m_NDims << std::endl; @@ -1092,6 +1150,10 @@ M_SetupReadFields(void) nDimsRecordNumber); m_Fields.push_back(mF); + mF = new MET_FieldRecordType; + MET_InitReadField(mF, "DistanceUnits", MET_STRING, false); + m_Fields.push_back(mF); + mF = new MET_FieldRecordType; MET_InitReadField(mF, "AnatomicalOrientation", MET_STRING, false); m_Fields.push_back(mF); @@ -1106,10 +1168,10 @@ M_SetupReadFields(void) FieldsContainerType::iterator it = m_UserDefinedReadFields.begin(); FieldsContainerType::iterator end = m_UserDefinedReadFields.end(); while( it != end ) - { + { m_Fields.push_back(*it); it++; - } + } } @@ -1256,6 +1318,15 @@ M_SetupWriteFields(void) m_CenterOfRotation); m_Fields.push_back(mF); + if(m_DistanceUnits != MET_DISTANCE_UNITS_UNKNOWN) + { + const char * str = DistanceUnitsName(); + mF = new MET_FieldRecordType; + MET_InitWriteField(mF, "DistanceUnits", + MET_STRING, strlen(str), str); + m_Fields.push_back(mF); + } + if(m_AnatomicalOrientation[0] != MET_ORIENTATION_UNKNOWN) { const char * str = AnatomicalOrientationAcronym(); @@ -1490,10 +1561,16 @@ M_Read(void) } } + mF = MET_GetFieldRecord("DistanceUnits", &m_Fields); + if(mF && mF->defined) + { + DistanceUnits((const char *)(mF->value)); + } + mF = MET_GetFieldRecord("AnatomicalOrientation", &m_Fields); if(mF && mF->defined) { - AnatomicalOrientation((char *)(mF->value)); + AnatomicalOrientation((const char *)(mF->value)); } mF = MET_GetFieldRecord("ElementSpacing", &m_Fields); diff --git a/Utilities/ITK/Utilities/MetaIO/metaObject.h b/Utilities/ITK/Utilities/MetaIO/metaObject.h index cffd3e84cd..4a93cc7db5 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaObject.h +++ b/Utilities/ITK/Utilities/MetaIO/metaObject.h @@ -4,8 +4,8 @@ #include <iostream> #include <fstream> -#include <metaUtils.h> -#include <metaEvent.h> +#include "metaUtils.h" +#include "metaEvent.h" extern int META_DEBUG; @@ -42,6 +42,8 @@ class MetaObject MET_OrientationEnumType m_AnatomicalOrientation[10]; + MET_DistanceUnitsEnumType m_DistanceUnits; // "DistanceUnits = mm" + float m_ElementSpacing[10]; // "ElementSpacing = " 0,0,0 float m_Color[4]; // "Color = " 1.0, 0.0, 0.0, 1.0 @@ -57,7 +59,8 @@ class MetaObject bool m_BinaryDataByteOrderMSB; unsigned int m_CompressedDataSize; - bool m_WriteCompressedDataSize; // Used internally to set if the dataSize should be written + // Used internally to set if the dataSize should be written + bool m_WriteCompressedDataSize; bool m_CompressedData; virtual void M_Destroy(void); @@ -174,6 +177,14 @@ class MetaObject void CenterOfRotation(const double * _position); void CenterOfRotation(int _i, double _value); + // + // + // + const char * DistanceUnitsName(void) const; + MET_DistanceUnitsEnumType DistanceUnits(void) const; + void DistanceUnits(MET_DistanceUnitsEnumType _distanceUnits); + void DistanceUnits(const char * _distanceUnits); + const char * AnatomicalOrientationAcronym(void) const; const MET_OrientationEnumType * AnatomicalOrientation(void) const; MET_OrientationEnumType AnatomicalOrientation(int _dim) const; @@ -239,13 +250,16 @@ class MetaObject // // // User's field definitions - bool AddUserField(const char* _fieldName,MET_ValueEnumType _type,int _length=0, - bool _required=true,int _dependsOn=-1); + bool AddUserField(const char* _fieldName, MET_ValueEnumType _type, + int _length=0, bool _required=true, + int _dependsOn=-1); + // Add a user's field template <class T> - bool AddUserField(const char* _fieldName,MET_ValueEnumType _type, int _length, - T *_v,bool _required=true,int _dependsOn=-1 ) - { + bool AddUserField(const char* _fieldName, MET_ValueEnumType _type, + int _length, T *_v, bool _required=true, + int _dependsOn=-1 ) + { MET_FieldRecordType* mFw = new MET_FieldRecordType; MET_InitWriteField(mFw, _fieldName, _type, _length,_v); m_UserDefinedWriteFields.push_back(mFw); @@ -255,7 +269,7 @@ class MetaObject m_UserDefinedReadFields.push_back(mFr); return true; - } + } // Clear UserFields void ClearUserFields(); @@ -265,8 +279,14 @@ class MetaObject void SetEvent(metaEvent* event) {m_Event = event;} // Set the double precision for writing - void SetDoublePrecision(unsigned int precision) {m_DoublePrecision = precision;} - unsigned int GetDoublePrecision() {return m_DoublePrecision;} + void SetDoublePrecision(unsigned int precision) + { + m_DoublePrecision = precision; + } + unsigned int GetDoublePrecision() + { + return m_DoublePrecision; + } }; diff --git a/Utilities/ITK/Utilities/MetaIO/metaScene.cxx b/Utilities/ITK/Utilities/MetaIO/metaScene.cxx index 3dff40fb7c..ef53de9892 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaScene.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaScene.cxx @@ -8,25 +8,26 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaScene.h> -#include <metaTube.h> -#include <metaDTITube.h> -#include <metaVesselTube.h> -#include <metaEllipse.h> -#include <metaGaussian.h> -#include <metaImage.h> -#include <metaBlob.h> -#include <metaLandmark.h> -#include <metaLine.h> -#include <metaGroup.h> -#include <metaSurface.h> -#include <metaLandmark.h> -#include <metaMesh.h> -#include <metaArrow.h> -#include <metaTransform.h> -#include <metaTubeGraph.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaScene.h" +#include "metaTube.h" +#include "metaContour.h" +#include "metaDTITube.h" +#include "metaVesselTube.h" +#include "metaEllipse.h" +#include "metaGaussian.h" +#include "metaImage.h" +#include "metaBlob.h" +#include "metaLandmark.h" +#include "metaLine.h" +#include "metaGroup.h" +#include "metaSurface.h" +#include "metaLandmark.h" +#include "metaMesh.h" +#include "metaArrow.h" +#include "metaTransform.h" +#include "metaTubeGraph.h" // // MetaScene Constructors @@ -217,6 +218,15 @@ Read(const char *_headerName) m_ObjectList.push_back(ellipse); } + else if(!strncmp(MET_ReadType(*m_ReadStream).c_str(),"Contour",7) || + ((MET_ReadType(*m_ReadStream).size()==0) && !strcmp(suf, "ctr"))) + { + MetaContour* contour = new MetaContour(); + contour->SetEvent(m_Event); + contour->ReadStream(m_NDims,m_ReadStream); + m_ObjectList.push_back(contour); + } + else if(!strncmp(MET_ReadType(*m_ReadStream).c_str(),"Arrow",5)) { MetaArrow* arrow = new MetaArrow(); diff --git a/Utilities/ITK/Utilities/MetaIO/metaScene.h b/Utilities/ITK/Utilities/MetaIO/metaScene.h index 362436cd68..133bd5a9d5 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaScene.h +++ b/Utilities/ITK/Utilities/MetaIO/metaScene.h @@ -1,9 +1,9 @@ #ifndef METASCENE_H #define METASCENE_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaSurface.cxx b/Utilities/ITK/Utilities/MetaIO/metaSurface.cxx index 3edadacb53..f79ead40a3 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaSurface.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaSurface.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaSurface.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaSurface.h" // // MetaSurface Constructors diff --git a/Utilities/ITK/Utilities/MetaIO/metaSurface.h b/Utilities/ITK/Utilities/MetaIO/metaSurface.h index cdffbcc80b..fb94c6d838 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaSurface.h +++ b/Utilities/ITK/Utilities/MetaIO/metaSurface.h @@ -1,9 +1,9 @@ #ifndef METASURFACE_H #define METASURFACE_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaTransform.cxx b/Utilities/ITK/Utilities/MetaIO/metaTransform.cxx index bf8099a076..60a2b81bca 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaTransform.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaTransform.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaTransform.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaTransform.h" /** MetaTransform constructors */ MetaTransform:: diff --git a/Utilities/ITK/Utilities/MetaIO/metaTransform.h b/Utilities/ITK/Utilities/MetaIO/metaTransform.h index 7507f91f17..bfdf913202 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaTransform.h +++ b/Utilities/ITK/Utilities/MetaIO/metaTransform.h @@ -1,9 +1,9 @@ #ifndef MetaTransform_H #define MetaTransform_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaTube.cxx b/Utilities/ITK/Utilities/MetaIO/metaTube.cxx index 17ddf20cd6..4896ad123e 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaTube.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaTube.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaTube.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaTube.h" /** MetaTube Constructors */ MetaTube:: diff --git a/Utilities/ITK/Utilities/MetaIO/metaTube.h b/Utilities/ITK/Utilities/MetaIO/metaTube.h index a2df07a485..0b9d2eb745 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaTube.h +++ b/Utilities/ITK/Utilities/MetaIO/metaTube.h @@ -1,9 +1,9 @@ #ifndef METATUBE_H #define METATUBE_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/metaTubeGraph.cxx b/Utilities/ITK/Utilities/MetaIO/metaTubeGraph.cxx index 58ecf37f3a..59b1c487fa 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaTubeGraph.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaTubeGraph.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaTubeGraph.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaTubeGraph.h" /** MetaTubeGraph Constructors */ MetaTubeGraph:: diff --git a/Utilities/ITK/Utilities/MetaIO/metaTubeGraph.h b/Utilities/ITK/Utilities/MetaIO/metaTubeGraph.h index 274510bd08..89f55d49f9 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaTubeGraph.h +++ b/Utilities/ITK/Utilities/MetaIO/metaTubeGraph.h @@ -1,9 +1,9 @@ #ifndef METATUBEGRAPH_H #define METATUBEGRAPH_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <vector> diff --git a/Utilities/ITK/Utilities/MetaIO/metaTypes.h b/Utilities/ITK/Utilities/MetaIO/metaTypes.h index 13da03abb3..acb4264adb 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaTypes.h +++ b/Utilities/ITK/Utilities/MetaIO/metaTypes.h @@ -25,7 +25,7 @@ typedef unsigned short MET_USHORT_TYPE; typedef int MET_INT_TYPE; typedef unsigned int MET_UINT_TYPE; typedef int MET_LONG_TYPE; -typedef unsigned int MET_ULONG_TYPE; +typedef unsigned long MET_ULONG_TYPE; #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MING_W32__) typedef __int64 MET_LONG_LONG_TYPE; typedef unsigned __int64 MET_ULONG_LONG_TYPE; @@ -128,8 +128,21 @@ const char MET_OrientationTypeName[MET_NUM_ORIENTATION_TYPES][3] = { {'S','I','\0'}, {'I','S','\0'}, {'?','?','\0'}}; - + +// Type associated with the units for distance measures reported in the header +typedef enum { MET_DISTANCE_UNITS_UNKNOWN, MET_DISTANCE_UNITS_UM, + MET_DISTANCE_UNITS_MM, MET_DISTANCE_UNITS_CM + } MET_DistanceUnitsEnumType; + +#define MET_NUM_DISTANCE_UNITS_TYPES 4 + +const char MET_DistanceUnitsTypeName[MET_NUM_DISTANCE_UNITS_TYPES][3] = { + {'?', '\0', '\0'}, + {'u', 'm', '\0'}, + {'m', 'm', '\0'}, + {'c', 'm', '\0'}}; + // Structure used to define a field (variable = value definition) in a MetaFile typedef struct { @@ -148,4 +161,15 @@ typedef struct } MET_FieldRecordType; +typedef enum { MET_NO_INTERPOLATION, MET_EXPLICIT_INTERPOLATION, MET_BEZIER_INTERPOLATION, MET_LINEAR_INTERPOLATION} + MET_InterpolationEnumType; + +#define MET_NUM_INTERPOLATION_TYPES 4 + +const char MET_InterpolationTypeName[MET_NUM_INTERPOLATION_TYPES][17] = { + {'M','E','T','_','N','O','N','E','\0',' ',' ',' ',' ',' ',' ',' ',' '}, + {'M','E','T','_','E','X','P','L','I','C','I','T','\0',' ',' ',' ',' '}, + {'M','E','T','_','B','E','Z','I','E','R','\0',' ',' ',' ',' ',' ',' '}, + {'M','E','T','_','L','I','N','E','A','R','\0',' ',' ',' ',' ',' ',' '}}; + #endif diff --git a/Utilities/ITK/Utilities/MetaIO/metaUtils.cxx b/Utilities/ITK/Utilities/MetaIO/metaUtils.cxx index eb60ce796f..d3f9d3f804 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaUtils.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaUtils.cxx @@ -10,8 +10,8 @@ #include <arpa/inet.h> #endif -#include <metaTypes.h> -#include <metaUtils.h> +#include "metaTypes.h" +#include "metaUtils.h" #include <stdlib.h> #include <string> @@ -1240,3 +1240,26 @@ bool MET_WriteFieldToFile(std::ostream & _fp, const char *_fieldName, return true; } +bool MET_StringToInterpolationType(const char * _str, + MET_InterpolationEnumType * _type) + { + int i; + + for(i=0; i<MET_NUM_INTERPOLATION_TYPES; i++) + if(!strcmp(MET_InterpolationTypeName[i], _str)) + { + *_type = (MET_InterpolationEnumType)i; + return true; + } + + *_type = MET_NO_INTERPOLATION; + + return false; + } + +bool MET_InterpolationTypeToString(MET_InterpolationEnumType _type, + char * _str) + { + strcpy(_str, MET_InterpolationTypeName[(int)_type]); + return true; + } diff --git a/Utilities/ITK/Utilities/MetaIO/metaUtils.h b/Utilities/ITK/Utilities/MetaIO/metaUtils.h index ab1d02887a..c13f29b08e 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaUtils.h +++ b/Utilities/ITK/Utilities/MetaIO/metaUtils.h @@ -28,7 +28,7 @@ #include <string> #include <typeinfo> -#include <metaTypes.h> +#include "metaTypes.h" @@ -240,9 +240,16 @@ inline MET_ValueEnumType MET_GetPixelType(const std::type_info& ptype) } else { - std::cerr <<"Couldn't convert pixel type" << std::endl; + std::cerr << "MET_GetPixelType: Couldn't convert pixel type : " + << ptype.name() << std::endl; return MET_NONE; } } +extern bool MET_StringToInterpolationType(const char * _str, + MET_InterpolationEnumType * _type); + +extern bool MET_InterpolationTypeToString(MET_InterpolationEnumType _type, + char * _str); + #endif diff --git a/Utilities/ITK/Utilities/MetaIO/metaVesselTube.cxx b/Utilities/ITK/Utilities/MetaIO/metaVesselTube.cxx index a9fc9c08f8..90bdc9378e 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaVesselTube.cxx +++ b/Utilities/ITK/Utilities/MetaIO/metaVesselTube.cxx @@ -4,9 +4,9 @@ #include <fstream> #include <string> -#include <metaUtils.h> -#include <metaObject.h> -#include <metaVesselTube.h> +#include "metaUtils.h" +#include "metaObject.h" +#include "metaVesselTube.h" /** MetaVesselTube Constructors */ MetaVesselTube:: diff --git a/Utilities/ITK/Utilities/MetaIO/metaVesselTube.h b/Utilities/ITK/Utilities/MetaIO/metaVesselTube.h index cd7f324f78..a161397a0a 100644 --- a/Utilities/ITK/Utilities/MetaIO/metaVesselTube.h +++ b/Utilities/ITK/Utilities/MetaIO/metaVesselTube.h @@ -1,9 +1,9 @@ #ifndef METAVesselTube_H #define METAVesselTube_H -#include <metaTypes.h> -#include <metaUtils.h> -#include <metaObject.h> +#include "metaTypes.h" +#include "metaUtils.h" +#include "metaObject.h" #include <list> diff --git a/Utilities/ITK/Utilities/MetaIO/tests/CMakeLists.txt b/Utilities/ITK/Utilities/MetaIO/tests/CMakeLists.txt index 6320d2e4d6..0a967078ad 100644 --- a/Utilities/ITK/Utilities/MetaIO/tests/CMakeLists.txt +++ b/Utilities/ITK/Utilities/MetaIO/tests/CMakeLists.txt @@ -30,4 +30,7 @@ SET( testMeta8Scene_SRCS testMeta8Scene.cxx ) ADD_EXECUTABLE( testMeta8Scene ${testMeta8Scene_SRCS} ) SET( testMeta9Landmark_SRCS testMeta9Landmark.cxx ) -ADD_EXECUTABLE( testMeta9Landmark ${testMeta9Landmark_SRCS} ) \ No newline at end of file +ADD_EXECUTABLE( testMeta9Landmark ${testMeta9Landmark_SRCS} ) + +SET( testMeta10Contour_SRCS testMeta10Contour.cxx ) +ADD_EXECUTABLE( testMeta10Contour ${testMeta10Contour_SRCS} ) -- GitLab