MCPcopy Create free account
hub / github.com/InsightSoftwareConsortium/ITK / SetOutput

Method SetOutput

Modules/Core/Common/src/itkProcessObject.cxx:417–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415
416
417void
418ProcessObject::SetOutput(const DataObjectIdentifierType & name, DataObject * output)
419{
420 /*
421 Set an Output of this filter. This method
422 * does Register()/UnRegister() manually to
423 * deal with the fact that smart pointers aren't
424 * around to do the reference counting.
425 */
426
427 // copy the key, because it might be destroyed in that method, so a reference
428 // is not enough.
429 const DataObjectIdentifierType key = name;
430
431 if (key.empty())
432 {
433 itkExceptionMacro("An empty string can't be used as an output identifier");
434 }
435
436 // does this change anything?
437 const auto it = m_Outputs.find(key);
438 if (it != m_Outputs.end() && it->second.GetPointer() == output)
439 {
440 return;
441 }
442
443 // Keep a handle to the original output and disconnect the old output from
444 // the pipeline
445 DataObjectPointer oldOutput;
446 if (m_Outputs[key])
447 {
448 oldOutput = m_Outputs[key];
449 m_Outputs[key]->DisconnectSource(this, key);
450 }
451
452 if (output)
453 {
454 output->ConnectSource(this, key);
455 }
456 // save the current reference (which releases the previous reference)
457 m_Outputs[key] = output;
458
459 // if we are clearing an output, we need to create a new blank output
460 // so we are prepared for the next Update(). this copies the requested
461 // region ivar
462 if (!m_Outputs[key])
463 {
464 itkDebugMacro(" creating new output object.");
465 const DataObjectPointer newOutput = this->MakeOutput(key);
466 this->SetOutput(key, newOutput);
467
468 // If we had an output object before, copy the requested region
469 // ivars and release data flag to the new output
470 if (oldOutput)
471 {
472 newOutput->SetRequestedRegion(oldOutput);
473 newOutput->SetReleaseDataFlag(oldOutput->GetReleaseDataFlag());
474 }

Callers 7

RemoveOutputMethod · 0.95
SetNthOutputMethod · 0.95
SetPrimaryOutputMethod · 0.95
GenerateDataMethod · 0.80
GenerateDataMethod · 0.80
DisconnectPipelineMethod · 0.80

Calls 11

MakeOutputMethod · 0.95
DisconnectSourceMethod · 0.80
ConnectSourceMethod · 0.80
SetRequestedRegionMethod · 0.80
SetReleaseDataFlagMethod · 0.80
GetReleaseDataFlagMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetPointerMethod · 0.45
ModifiedMethod · 0.45

Tested by 2

GenerateDataMethod · 0.64