BUG: depreciated flag of BRAINS was changed

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23423 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fixed VTK 6 incompatibility in LabelStatistics

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23424 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: vtkNRRDReader filename ambiguity. Fixes #3766

Slicer has a class vtkNRRDReader in Libs/vtkTeem. VTKv4 has a class
vtkNrrdreader in VTK/IO/Image. On case insensitive file systems
(e.g. Windows and some Macs), the statement #include "vtkNRRDReader.h"
will actually include the file vtkNrrdReader (from VTKv6). The
compiler will report the error: error: ‘vtkNRRDReader’ was not
declared in this scope.

CLI's that explicitly include vtkNRRDReader will have these
errors.
Prior to check-in:
https://github.com/Slicer/Slicer/commit/f0f0df61038b9591e895ccb4a40256167e5366d3
a cmake statement:
include_directories(BEFORE ${vtkTeem_INCLUDE_DIRS})
insured that the Slicer vtkNRRDReader would be found.

This patch restores the
include_directories(BEFORE ${vtkTeem_INCLUDE_DIRS})
with a more descriptive comment to prevent its removal in the future.

From: Bill Lorensen <bill.lorensen@gmail.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23425 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Extesions did not look in right directory - in addition CMTK could pass even if CMTK was not installed as EMSegmenter automatically switches to Brains

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23426 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fixed saving of inverted linear transforms (conversion to ITK sense was missed for inverse transforms)

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23427 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fixed crash on scene close when the Transforms module is active

Units module triggered an update in the Transforms module GUI after the current transform node has been already deleted.
Use a weak pointer to make sure no dangling pointers are accidentally used.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23428 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Update OpenIGTLinkIF - Add new message converters. Fixes #3548 & #3738

Also update GUI to allow users to push MRML nodes (#3738)

From: Junichi Tokuda <tokuda@bwh.harvard.edu>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23429 3bd1e089-480b-0410-8dfb-8563597acbee
COMP: Ensure DCMTK libraries are packaged.

This commit fixes a regression introduced in r23413 where call to
"find_package(DCMTK ..)" have been moved in the sub-project where
it was explicitly needed. By calling, "find_package(DCMTK ..)", it
now ensures that the variable "DCMTK_LIBRARIES" will be set.

Note that ideally DCMTK libraries could be installed leveraging the
fact the project is cmake'ified by installing the expected components.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23430 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Add test checking reference set to null or empty string are removed.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23431 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Consistently use "referencedNodeID" parameter name

To make maintenance of the code easier, the same parameter name
is used across all MRML node reference functions.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23432 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: update to new LandmarkRegistration

Now with interactive ThinPlate registration!
- uses real-time nonlinear transform updates
- compatible with transform visualization

Other improvments and upgrades, like VTKv6 support and
generalization of the plugin architecture.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23433 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: fix type of argument to SetGridExtent for LandmarkRegistration

Exposed by vtk v5 vs v6 testing.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23434 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fix infinite loop when opening or closing a scene

This commit fixes a regression introduced by commit r23191.

Commit r23191 simplified the code introducing smart pointer, typedefs and
also updated "SetNthNodeReferenceID" and "SetAndObserveNthNodeReferenceID"
so that they have have similar code. It turns out that after this update
new reference where systematically created with an ID being an empty string
instead of being a NULL string.

Commits following r23191 also updated the MRML reference system and
attempted to fix what was most likely an issue with the "SetNth" methods.
See r23192, r23196]. These commits fixes the behavior of the SetNth methods
so that setting a reference N was always returning the
associated reference if the reference n-1 was removed.

It turned out that these changes caused more trouble than expected and
to fully support the new behavior, major and backward incompatible changes
in the displayable and storable nodes and also in the scene serialization
would have occur. For that reason, commit r23395 and r23414 have been
integrated to revert all commit updating the behavior but keeping the
"smart pointer" and "typedefs" updates around.

It is only by "reverting" these last commit that the issue fixed by
this commit was revealed.

Note for later:

 * In method almost doing the same thing, do not comment code without
clearly mentioning the reason.

 * If very similar functions are doing almost the same thing, re-factoring
the code is key to reduce the maintenance burden.

Finally, this commit also update method "UpdateNthNodeReference"
to set the ReferencingNode (it was done before the commit introducing
smart pointers), the questions are "Why is this needed ?" and
"What is causing the reference to be dissociated from a referencing node?"

Fixes #3754
Fixes #3768

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23435 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fix crash in vtkMRMLNode::UpdateNthNodeReference

This commit fixes regression introduced in previous commit r23435.
Interestingly the message in previous commit raised the question about
the assignment ReferencingNode. It turns out that the method
UpdateNthNodeReference was indirectly called after destroying the
referencing node.

The following pseudo stack trace illustrates the issue:

(obtained while running the test "vtkMRMLVolumeNodeTest1"

Destructor of vtkMRMLVolumeNode (referencing node)
-> SetImageDataConnection(0)
-> SetImageDataToDisplayNodes()
-> GetNthDisplayNode(n)
-> GetNthNodeReference()
-> UpdateNthNodeReference(referenceRole, n)
-> UpdateNthNodeReference(reference, n)
this->ReferencingNode = this

Since ReferencingNode is a weakpointer to the object represented by "this"
and was indirectly called in the destructor of "this", this was
causing a double free or corruption error. It was reported in valgrind
as a "invalid read of size 8".

The test is now passing. But valgrind is still reporting the error
like this one:

Generic Warning: In /home/jchris/Projects/Slicer-2-SuperBuild-Debug/VTKv6/Common/Core/vtkDebugLeaks.cxx, line 292
Deleting unknown object: vtkMRMLVolumeNodeTestHelper1

They will be fixed in follow-up commit.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23436 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Add vtkMRMLDisplayableNode method definition to cpp file.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23437 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Add vtkMRMLStorableNode method definition to cpp file.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23438 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fix "Deleting Unknown Object" warning in mrml node tests

This commits (1) changes the helper node class name associated with the
hierarchy node to be unique and (2) updates the helper node definitions
to be consistent with the helper node declared in vtkMRMLNodeTest1.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23439 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fix valgrind issues in vtkMRMLVolumeNodeTest1

This commit fixes regression introduced by commit r19917. Instead
of re-implementing Get{I,J,K}ToRASDirection methods, the
macro "TEST_SET_GET_VECTOR3_DOUBLE_RANDOM" has been updated to directly
use the Set/Get method of the object. It then (1) avoids to return a
pointer and (2) avoids to access possibly uninitialized value with the
bracket operator.

Valgrind errors like this one are fixed:

[...]

==20657== Conditional jump or move depends on uninitialised value(s)
==20657==    at 0x626297: vtkMRMLVolumeNodeTest1(int, char**) (vtkMRMLVolumeNodeTest1.cxx:114)
==20657==    by 0x4717DC: main (MRMLCoreCxxTests.cxx:616)

[...]

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23440 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: LandmarkRegistration improvements (and fixed test on vtk5 and vtk6)

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23441 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: fix method name difference between vtk 5 and 6

Fixes failing test on vtk 6.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23442 3bd1e089-480b-0410-8dfb-8563597acbee