MCPcopy Create free account
hub / github.com/MITK/MITK / Sort

Method Sort

Modules/DICOM/src/mitkEquiDistantBlocksSorter.cpp:251–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251void
252mitk::EquiDistantBlocksSorter
253::Sort()
254{
255 DICOMDatasetList remainingInput = GetInput(); // copy
256
257 m_SliceGroupingResults.clear();
258
259 while (!remainingInput.empty()) // repeat until all files are grouped somehow
260 {
261 auto regularBlock = this->AnalyzeFileForITKImageSeriesReaderSpacingAssumption( remainingInput, m_AcceptTilt );
262
263#ifdef MBILOG_ENABLE_DEBUG
264 DICOMDatasetList inBlock = regularBlock.GetBlockDatasets();
265 DICOMDatasetList laterBlock = regularBlock.GetUnsortedDatasets();
266 MITK_DEBUG << "Result: sorted 3D group with " << inBlock.size() << " files";
267 for (DICOMDatasetList::const_iterator diter = inBlock.cbegin(); diter != inBlock.cend(); ++diter)
268 MITK_DEBUG << " IN " << (*diter)->GetFilenameIfAvailable();
269 for (DICOMDatasetList::const_iterator diter = laterBlock.cbegin(); diter != laterBlock.cend(); ++diter)
270 MITK_DEBUG << " OUT " << (*diter)->GetFilenameIfAvailable();
271#endif // MBILOG_ENABLE_DEBUG
272
273 remainingInput = regularBlock->GetUnsortedDatasets();
274
275 if (remainingInput.empty() && !m_SliceGroupingResults.empty() && m_SliceGroupingResults.back()->GetSplitReason()->HasReason(IOVolumeSplitReason::ReasonType::OverlappingSlices))
276 {
277 //if all inputs are processed and there is already a preceding grouping result that has overlapping as split reason, add also overlapping as split reason for the current block
278 regularBlock->GetSplitReason()->AddReason(IOVolumeSplitReason::ReasonType::OverlappingSlices);
279 }
280
281 m_SliceGroupingResults.push_back( regularBlock );
282 }
283
284 unsigned int numberOfOutputs = m_SliceGroupingResults.size();
285 this->SetNumberOfOutputs(numberOfOutputs);
286
287 unsigned int outputIndex(0);
288 for (auto oIter = m_SliceGroupingResults.cbegin();
289 oIter != m_SliceGroupingResults.cend();
290 ++outputIndex, ++oIter)
291 {
292 this->SetOutput(outputIndex, (*oIter)->GetBlockDatasets(), (*oIter)->GetSplitReason());
293 }
294}
295
296void
297mitk::EquiDistantBlocksSorter

Callers

nothing calls this directly

Calls 11

HasReasonMethod · 0.80
backMethod · 0.80
AddReasonMethod · 0.80
clearMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
GetSplitReasonMethod · 0.45
SetNumberOfOutputsMethod · 0.45
SetOutputMethod · 0.45

Tested by

no test coverage detected