52 timeinfo = std::localtime(&rawtime);
54 std::strftime(buffer, 80,
"%Y%m%d-%H%M%S", timeinfo);
56 return std::string(buffer);
61 static const char alphanum[] =
"0123456789"
62 "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
64 for (
int i = 0; i < len; ++i)
66 s[i] = alphanum[rand() % (
sizeof(alphanum) - 1)];
74 if (len > 0 && len < 100)
78 return std::string(retval);
82 return std::string(
"");
89 for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
92 if ((c >=
'0' && c <=
'9') || (c >=
'A' && c <= 'Z') || (c >=
'a' && c <=
'z') || (c ==
'.') || (c ==
'-') ||
103 std::string wholeprefix = dirString.substr(0, dirString.find_last_of(
"/\\"));
104 std::string lastDirectoryPart = wholeprefix.substr(wholeprefix.find_last_of(
"/\\") + 1);
106 if (!cleanLastDirectoryPart.empty())
108 return cleanLastDirectoryPart;
112 std::stringstream emptydirname;
115 return emptydirname.str();
119 int main(
int argc,
char *argv[])
121 bool fileDetails(
false);
122 bool loadimage(
false);
123 int firstFileIndex = 1;
126 if (argc > 1 && std::string(argv[firstFileIndex]) ==
"-v")
133 if (argc > 1 && std::string(argv[firstFileIndex]) ==
"-l")
141 for (
int a = firstFileIndex; a < argc; ++a)
143 inputFiles.push_back(std::string(argv[a]));
146 if (inputFiles.empty())
148 MITK_INFO <<
"0 input files given, exiting...";
153 configSelector->LoadBuiltIn3DConfigs();
154 configSelector->SetInputFiles(inputFiles);
158 MITK_ERROR <<
"Could not configure any DICOM reader.. Exiting...";
163 MITK_INFO <<
"---- Best reader configuration '" << reader->GetConfigurationLabel() <<
"' with "
164 << reader->GetNumberOfOutputs() <<
" outputs";
167 reader->PrintOutputs(std::cout, fileDetails);
174 std::string logfilename = datestring +
"_dir_" + dirString +
".mitkdump";
179 fs.open(logfilename.c_str());
180 fs <<
"---- " << dirString <<
": Best reader configuration '" << reader->GetConfigurationLabel() <<
"' with "
181 << reader->GetNumberOfOutputs() <<
" outputs" << std::endl;
182 reader->PrintOutputs(fs,
true);
187 std::string readerSerialization = serializer->CreateConfigStringFromReader(reader.GetPointer());
189 bool outputError(
false);
190 for (
unsigned int outputIndex = 0; outputIndex < reader->GetNumberOfOutputs(); ++outputIndex)
196 for (
auto fIter = frames.begin(); fIter != frames.end(); ++fIter)
198 filenamesOfThisGroup.push_back((*fIter)->Filename);
203 dicomReader->SetInputFiles(filenamesOfThisGroup);
204 dicomReader->AnalyzeInputFiles();
205 if (dicomReader->GetNumberOfOutputs() != 1)
207 MITK_ERROR <<
"****** Re-analyzing files of output group " << outputIndex <<
" yields "
208 << dicomReader->GetNumberOfOutputs() <<
" groups";
211 for (
auto fIter = frames.begin(); fIter != frames.end(); ++fIter)
213 MITK_INFO <<
"filename group " << outputIndex <<
": " << (*fIter)->Filename;
218 MITK_INFO <<
"Re-analyzing files of output group " << outputIndex <<
" yields "
219 << dicomReader->GetNumberOfOutputs() <<
" groups";
225 std::stringstream es;
226 es <<
"Original reader configuration: " << std::endl;
227 reader->PrintConfiguration(es);
231 es <<
"New reader configuration: " << std::endl;
232 dicomReader->PrintConfiguration(es);
235 es <<
"Original XML: \n" << readerSerialization << std::endl;
236 std::string newSerialization = serializer->CreateConfigStringFromReader(dicomReader.GetPointer());
237 es <<
"New XML: \n" << newSerialization << std::endl;
244 reader->LoadImages();
248 if (geo3D.IsNotNull())
253 unsigned int nos = sg->GetSlices();
259 MITK_INFO <<
"Geometry says: First slice at " << firstOrigin <<
", last slice at " << lastOrigin;
263 if (sliceLocations.IsNotNull())
265 std::string firstSliceLocation = sliceLocations->GetValue().GetTableValue(0);
266 std::string lastSliceLocation = sliceLocations->GetValue().GetTableValue(nos - 1);
267 MITK_INFO <<
"Image properties says: first slice location at " << firstSliceLocation
268 <<
", last slice location at " << lastSliceLocation;
273 if (instanceNumbers.IsNotNull())
275 std::string firstInstanceNumber = instanceNumbers->GetValue().GetTableValue(0);
276 std::string lastInstanceNumber = instanceNumbers->GetValue().GetTableValue(nos - 1);
277 MITK_INFO <<
"Image properties says: first instance number at " << firstInstanceNumber
278 <<
", last instance number at " << lastInstanceNumber;
section MAP_FRAME_Mapper_Settings Mapper settings For the mapping of corrected you have several settings but high interpolation errors for gray value images Right choice for label images or masks li Details of the frame selection In this tab you can specify the frames of the currently selected image that should be corrected As default all frames of an image will be corrected If you only select specific frames
const DICOMImageFrameList & GetImageFrameList() const
List of frames that constitute the mitk::Image (DICOMImageFrames)
itk::SmartPointer< Self > Pointer
std::string removeUnsafeChars(const std::string &str)
Representation of a DICOM tag.
int main(int argc, char *argv[])
std::string extractDirString(const std::string &dirString)
void gen_random(char *s, const int len)
std::vector< DICOMImageFrameInfo::Pointer > DICOMImageFrameList
Output descriptor for DICOMFileReader.
std::vector< std::string > StringList
Describes the geometry of a data object consisting of slices.
std::string buildDateString()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.