} ////
//------------------------------------------------------------------
+
+//------------------------------------------------------------------
+// Return filename splitting in 1 or 2 parts : directory name (if exists) & filename
+std::vector<std::string> clitk::SplitFilename(const std::string& filename)
+{
+ std::vector<std::string> dirname;
+ std::size_t found = filename.find_last_of("/\\");
+ dirname.push_back(filename.substr(0,found));
+ dirname.push_back(filename.substr(found+1,found));
+ return( dirname );
+} ////
+//------------------------------------------------------------------
+
+
//------------------------------------------------------------------
// Display progression
void clitk::VerboseInProgress(const int nb, const int current, const int percentage)
// Return filename extension
std::string GetExtension(const std::string& filename);
+ // Return filename splitting in 1 or 2 parts : directory name (if exists) & filename
+ std::vector<std::string> SplitFilename(const std::string& filename);
+
//--------------------------------------------------------------------
// Convert float, double ... to string
template<class T> std::string toString(const T & t);
series_number_att.SetFromDataSet(ds);
series_number = series_number_att.GetValue();
}
-
+
series_numbers.insert(series_number);
theorigin[series_number] = gdcm::ImageHelper::GetOriginValue(hreader.GetFile());
theorientation[series_number] = gdcm::ImageHelper::GetDirectionCosinesValue(hreader.GetFile());
theorigin[series_number][2]*n3;
sliceLocations[series_number].push_back(sloc);
seriesFiles[series_number].push_back(input_files[i]);
-
+
gdcm::Attribute<0x28, 0x100> pixel_size;
pixel_size.SetFromDataSet(ds);
/* if (pixel_size.GetValue() != 16)
if (args_info.extract_series_flag) {
series_number = atoi(header->GetEntryValue(0x20,0x11).c_str());
}
-
+
series_numbers.insert(series_number);
theorigin[series_number].resize(3);
theorigin[series_number][0] = header->GetXOrigin();
std::cerr << reader->GetLastError() << std::endl;
return 1;
}
-
+
vvImage::Pointer image = reader->GetOutput();
vtkImageData* vtk_image = image->GetFirstVTKImageData();
vtkImageChangeInformation* modifier = vtkImageChangeInformation::New();
outfile = args_info.output_arg;
else {
std::ostringstream name;
- name << *sn << "_" << args_info.output_arg;
+ std::vector<std::string> directory = clitk::SplitFilename(args_info.output_arg);
+ if (directory.size() == 2)
+ name << directory[0] << *sn << "_" << directory[1];
+ else
+ name << *sn << "_" << args_info.output_arg;
outfile = name.str();
}
//Check on transform
writer->Update();
modifier->Delete();
-
+
sn++;
}
-
+
return 0;
}