const gdcm::DataElement & contourdata = nestedds2.GetDataElement( tcontourdata );
at.SetFromDataElement( contourdata );
const double* points = at.GetValues();
- unsigned int npts = at.GetNumberOfValues() / 3;
assert(at.GetNumberOfValues() == static_cast<unsigned int>(mNbOfPoints)*3);
#include <stdlib.h>
#include <itksys/SystemTools.hxx>
const int NO_OUTPUT_OPTION=-1;
+const int TEST_EXITED=1;
int getOutputOptionIndex(int argc, char** argv){
for(int i=1; i<argc; i++){
std::string s = argv[i];
return NO_OUTPUT_OPTION;
}
std::string getTmpFileName(){
- char buffer [L_tmpnam];
- char* back = tmpnam (buffer);
- if(back==NULL){
- exit(1);
+ char fileName[] = "/tmp/vvTempXXXXXX";
+ int fd = mkstemp(fileName);
+ if(fd==-1){
+ std::cout<<"couldnot create file. Exiting"<<std::endl;
+ exit(TEST_EXITED);
}
- return std::string(back);
+ return std::string(fileName);
}
/**
* argv
std::string outFile;
if(NO_OUTPUT_OPTION==outputOptionIndex){
outFile = getTmpFileName();
+ std::cout<<outFile<<std::endl;
cmd_line<<">"<<outFile;
}else{
//todo test this else branch
int main(int argc, char** argv){
QApplication* q=new QApplication ( argc, argv );
::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+
+ int a=RUN_ALL_TESTS();
+ delete q;
+ return a;
}