BUG: Ensure python script argument are not loaded as image. Fixes #3463

Co-authored-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>

From: Felix Veysseyre <felix.veysseyre@kitware.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22658 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Update CTK to integrate Andras Lasso VTK connection optimization.

Andras Lasso (3):
      ENH: Use a hashmap to avoid linear search for existing vtk connections
      BUG: Fixed ctkVTKObjectEventsObserverPrivate::findConnection behavior for wildcards
      ENH: qvtkConnect and qvtkDisconnect performance improvement

Jean-Christophe Fillion-Robin (1):
      Merge branch 'vtkconnect-performance-improvement-consolidated'
ENH: Don't batch process when show/hide only a few child nodes

When there are many child nodes in a hierarchy then show/hide is much more efficient if batch processing is enabled.
However, if there are few nodes only then a full refresh at the end of a batch processing takes longer than doing the update on each node separately.
Count the number of child nodes and if there are less than 30 then update each node separately.
ENH: Add BatchUpdateThreshold to Model hierarchy logic

Only use batch processing for show/hide of model hierarchies if the
total number of nodes in the selected branch is larger than a given threshold.
BUG: Fixed references to nodes in qSlicerTractographyDisplayWidget

Crash happened at the end of SceneClose in py_test_tractography_display test because old (invalid) display node was still used.
ENH: vtkEventBroker performance improvement

Use a set instead of a vector to allow faster finding and deletion of observations
ENH: Optimized qMRMLSceneModel::nodeIndex performance

qMRMLSceneModel::nodeIndex is called tens of millions of times, therefore it's optimum performance is critical.
Find MRML nodes by object pointer instead of ID comparison to improve the performance.

Also, always do lazyupdate for qMRMLSceneModel if scene is closing to unsubscribe from all events at once the scene is closed.
ENH: Improved performance of qMRMLSceneModel

The indexFromNode method is called millions of times when there are a few hundred nodes and it browses through the whole model to find the requested node. Add a cache that stores the last search result and use it as a search hint.
New rows are always added to the cache, so the cache alone can be used to determine if a node is not yet in the model.
STYLE: Simplify code using vtkNew to register node with MRML scene
ENH: Optimized performance of observations management in vtkMRMLScene

Use a std::map< std::string, std::set<std::string> > instead of two separate ReferencedIDs and ReferencingNodes vectors to make lookup, insertion, and deletion much faster (especially scene close takes much shorter time now).
Store both referenced and referring nodes by ID. It is simpler, safer, and most of the time the node pointers were validated anyway using scene->GetNodeFromID(node->GetID().

Also, use set instead of vector for storing unique IDs for improving performance of scene loading (especially when the same scene is loaded twice and a lot of IDs have to be generated).
STYLE: Update comment, fix indent and style in vtkMRMLScene
COMP: Update vtkMRMLScene::RemoveUnusedNodeReferences to work with C++98
COMP: Fixed signed/unsigned int compiler warning in vtkMRMLScene