BUG: Fix libpng warnings in console when loading images with Qt 5
This commit applies a fix identical to the one found in Slicer r24571 and authored
by Max Smolens. It eliminates the following libpng warning seen when loading certain
PNG images using libpng 1.6.x, which is included in Qt 5:
libpng warning: iCCP: known incorrect sRGB profile
To fix the images I ran them through ImageMagick, which removes the incorrect
profiles, as suggested in [1]:
convert image.png image.png
libpng 1.6.17 describes the warning in png.c line 2308:
/* These profiles are known to have bad data that may cause
* problems if they are used, therefore attempt to
* discourage their use, skip the 'have_md5' warning below,
* which is made irrelevant by this error.
*/
[1] http://stackoverflow.com/questions/22745076/libpng-warning-iccp-known-incorrect-srgb-profile
Co-authored-by: Max Smolens <max.smolens@kitware.com>

COMP: Fix warning removing explicit setting of CMake policy CMP0017.
Setting of CMP0017 to OLD is not needed.
This commit addresses the following warning reported when using CMake 3.9.0:
See https://github.com/Slicer/Slicer/pull/765

BUG: Fix import of python modules.
This commit fixes a regression introduced in r17117 (ENH: Simplify import
of Logic/MRML/DisplayableManager python modules). It ensures python modules
built on system using intermediate directories (e.g Visual Studio) can
be imported.

COMP: Fix Python wrapping with VTK 7.1
When Slicer is built with the VTK 7.1, Python wrapping failed with errors
similar to:
C:\path\to\Slicer-build\Modules\Remote\EMSegment\Qt\Logic\vtkTimeDefPython.cxx(73): error C2440: 'return' : cannot convert from 'vtkTimeDef *' to 'vtkObjectBase *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\path\to\Slicer-build\Modules\Remote\EMSegment\Qt\Logic\EMLocalShapeCostFunctionPython.cxx(24): error C2440: 'static_cast' : cannot convert from 'vtkObjectBase *' to 'EMLocalShapeCostFunction *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
This happens because VTK wrapping no longer recognizes BTX/ETX markers as
indicators to skip wrapping of a block of code; see Kitware/VTK@55878a2. In many
cases the updated wrapping tools can handle code that was previously had to be
skipped, but in this case wrapping still fails.
In VTK 7.1 blocks of code can be skipped for wrapping by checking whether
__VTK_WRAP__ is defined.

COMP: Fix compilation with VTK 7.1
When Slicer is built with the current VTK master (upcoming VTK 7.1), compilation
fails because of several deprecated headers and methods. This commit fixes
compilation with VTK 7.1 by updating the usage of the deprecated headers and
methods. Compatibility with the current version of VTK that Slicer uses is
maintained.
Specific changes accounted for include:
- Kitware/VTK@d9c5ca0
(Mark legacy methods as "legacy".)
- Kitware/VTK@3ae7dd3
(ENH: Remove use of include <vtksys/ios/*> and vtksys_ios::*)
- Kitware/VTK@eaf0f6a
(ENH: Remove use of include <vtksys/stl/*> and vtksys_stl::*)

STYLE: Fix CMake warning setting CMP0048 to NEW
This commit will avoid the following warning:
//-----------------------------------------
Policy CMP0048 is not set: project() command manages VERSION variables.
Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
The following variable(s) would be set to empty:
PROJECT_VERSION
PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR
PROJECT_VERSION_PATCH
//-----------------------------------------

BUG: update test MRML to include singletonTag
As of Slicer4 svn 24582 the vtkMRMLNode is writing
out the singleton tag to MRML. Update this testing
MRML file to include it so that the test EMSeg_MRML_DiffReadWriteNodes
will pass when comparing the baseline mrml file to the
written one.
Issue #4006

BUG: Remove invalid BRAINSFit argument
This commit removes deprecated (and unused for a long time) command line options
from the most recent version of BRAINSTools. These command line options have
been NO-OP operations for a long time. They have been removed in the version
of BRAINSTools now used in Slicer r23872.
Thanks to "Hans Johnson <hans-johnson@uiowa.edu>" for providing the patch.

BUG: Task directory got copied over everytime running emsegmenter which can cause issues when running multiple instances of the EMSegmenter - fixed now - only copying when time stamp of source directory newer then tmp dir

BUG: Fixed bug with respect to Image inhomogeneity; included vtkImageLabelPropagation in SlicerCommonInterFaceTest1 so it would fail as this is also the reason for EMSegCL_Task_MRIHumanBrainFullParcellation_BRAINS_small failing

COMP: Fix compilation against VTKv6.
This commits fixes build error introduced by r17053.
Few tests are still failing due to memory leaks and will
be fixed at a later time:
* EMSegCL_Task_MRIHumanBrain_BRAINS_small
* EMSegCL_Task_MRIHumanBrainFullParcellation_BRAINS_small

COMP: Avoid implicit narrowing casts
Explicitly cast initializers in {} array initializer where the assigned type is smaller than the value type. This avoids implicit narrowing in a {} initializer, which is ill-formed in C++11.

COMP: Remove gratuitous virtual
Remove 'virtual' specifier of private class in source file, where said class is not and (due to being in a source file) never will be derived. This avoids needing an explicit (virtual) dtor in order to avoid a -Wnon-virtual-dtor warning.

BUG: fix issue where label map opacity slicer goes away just when you are trying to use it. Now user must expliticly dismiss the window, but the advantage is that you can interact for a while without picking the menu again

ENH: AtlasCreator: Merge from Trunk. Fixed a serious blocker and other smaller bugs. Added the Cxx guiless module to include C++ code. Added a commandline interface which can be launched: python atlascreator.py. Interface and code much cleaner now.

BUG: vtkImageNeighborhoodFilter does not handle correctly kernel size
different from (3,3,3), which results in incorrectly initialized mask for
kernel (5,5,5). The earlier change is reverted pending resolution of the nei
filter issue.

BUG: merge of r15877 from trunk: BUG: several fixes: improved event handling to threshold options are preserved (avoid MRML/GUI event intermingling); improved threshold behavior (no recalc if being used for paint, set threshold mode when Use For Paint is picked)

ENH: Added logic to check for strange gradients in Siemens data and added a command line argument to force the calculation of the B values and directions from the B-matrix which exists in a private tag in siemens data.
BUG: Updated to correctly handle endianness differences between dicom and system.
STYLE: Cleaned up some of the code and slightly improved cross-platform compatibility.

BUG: when restoring a scene that has fewer fiducials in a fiducial list, there were unattached seeds left in the widget. Remove those during Update3DWidget by comparing the number of fids in the list versus seeds in the widget and removing extras. Missing ones will be added automatically. Port from trunk svn 15490

ENH: deleted lots of code in UpdateLocatorTransform(): all that this code did, was (a) applying the registration matrix to the original tracker data by calling ApplyTransform() and (b) a rotation of -90 degrees around the x-axis; (a) can be done in a single line within UpdateLocatorTransform(); consequently, ApplyTransform() was removed; (b) should be done only ONCE upon creation of the locator model in AddLocatorModel() instead of rotating the locator model every time UpdateLocatorTransform() is called; consequently, this code was removed and a rotation of -90 degrees around the x-axis will be added to AddLocatorModel() in the next commit to compensate for this

ENH: Prevent recompilation of the whole ProstateNav module when the working copy is updated (only one file is still recompiled, to embed the working copy revision information) (Merged from trunk rev 15438)

ENH: fixing bug causing actors in scene to respect different cameras. Was causing scene saved with spinning/rocking turned on to load without spinning/rocking and axis label actors to not respect current active camera.

BUG: making the warning for duplicate filenames in the list of checked files to save more prominent so it's harder to mindlessly click ok. Presentation for error message that file is already on disk is different and less warning-y.

BUG: Reformat Widget in linked compare views. Slice node would change the interaction mode on a slice if it recognized the slice as an axial, sagittal, coronal. This would pull a slice out of reformat mode. Modified code to allow reformations to be done without being in reformat mode. Optimized reformat widget use to only modify one slice node while interacting and then communicating to the linked nodes at the end of the interaction. Updated the logic for linked logics in SlicePlaneSWidget to match SliceSWidget

BUG: when reading in a mrml scene that contains FiducialSeedingParameters node information that points to invalid fiducial lists or volumes or output tracts, seeding from a fiducial would break once valid seeds were added and moved around. Test for valid nodes before setting up the node selector and observers

BUG: fixing bug 840, return from RequestRender if rendering is disabled, so don't get into a state where rendering is disabled and a render is pending as RequestRender calls will not break out of that state. Updated Print with camera and view node.

BUG: Propagate API change into vtkSlicerOpenGLVolumeTextureMapper3D.
On 2010/07/20, the API for IsRenderSupported() has been changed in
vtkSlicerVolumeTextureMapper3D.h. However it has not been propagated in
vtkSlicerOpenGLVolumeTextureMapper.

BUG: initializing the 'pickable' state of seedwidgets when they are first placed based on mouse-mode. This prevets a hover event from stealing the mouse mode from 'persistent place' and giving it to 'pick' mode.

ENH: In response to numerous constructive critisms of the newly added suite of BRAINSTools, a code review was performed in order to make the applications work consistenently and with similar user interfaces.
Summary of ChangeLog:
-Instrumented xml files so that moving images are properly associated with their transforms in the Slicer3 MRML Interface.
-Made command line arguments consistent across tools for specifying images, transforms, similar parameters.
-Hid many advanced command line arguments from standard user interface when used from Slicer3
-Improved documentation of command line arguments to describe better what the intended purpose, and restrictions on use are.
-Added common set of image resample/warping options across all tools so that all tools provide common interface for choosing outputPixelType and interpolation mode
-Fixed reading and writing of transforms to use a common read/write paradigm, to be consistent across all tools, and to be compatible with Slicer3 (i.e. Write out Bspline transforms with the bulk transform given second).
-Increased code coverage by merging common functionality that existed in each tool separately into the BRAINSCommonLIb, thus removing code, and ensuring that exactly the same behavior was done across all tools.
-Worked around bug where ITK LSBFGSB optimizer does not properly return the number of iterations performed, This improperly reported that Bspline registrations were never done when doing a Bspline registration alone.
-Improved source code documentation for commonly used functions.
-Removed obsolete code to improve code coverage
-Added feature to BRAINSResample that allows grid lines to be created in the image. ENH: Made test cases more tolerant of slight image difference due to numerical precision.
-Fixed bug in BRAINSResample regarding the output image type

ENH: Added method moduleType() to qSlicerCLIModule and its derived class
In qSlicerCLIModule::setXmlModuleDescription, the module type is then set
on the ModuleDescription object.
Later on, after the user click "Apply" button, a valid ModuleDescription
object is now used within the vtkSlicerCLIModuleLogic class

BUG: In qSlicerCoreApplication, the use of QSharedPointer ensure that qSlicerCoreIOManager is destroyed
That also fixes the segmentation fault related to startTimer/QThread
which was happening when the user exits the application.

ENH: Document and review class qSlicerCoreIOManager
Rename function loadNode into loadNodesAndGetFirst
In function 'loadNodes', instead of returning false when the count of loaded nodes
is zero, it now returns false only if no reader manage to read the
given file.

BUG: Update ProstateNav/CMakeLists.txt - ProstateNav_REVISION is now obtained using either Subversion_WC_INFO or Git_WC_INFO
As of today, ProstateNav_REVISION will be generated properly only if it is checkout from SVN repo.

BUG: Update both the main and superbuild CMakeLists.txt to include Slicer3_BINARY_DIR/CMake in CMAKE_MODULE_PATH
That way, the downloaded file: ExternalProject.cmake and FindCTK.cmake will be
available ...

ENH: Added convenient macro 'downloadFile' to SuperBuild/CMakeLists.txt used
to download the version available on the CTK repository.
This later one provides the options: SVN_USERNAME, SVN_PASSWORD and GIT_REPOSITORY

ENH: SlicerQT - Added method 'extractModuleName' to qSlicerLoadableModuleFactory. Also added test qSlicerLoadableModuleFactoryTest1
Currently, modules are uniquely identified using their library name.
This later one is platform specific. For example, ThresholdLib.dll on windows
or libThresholdLib.so on linux.
This method allows to return the same identified in all cases.
In this example, 'threshold' will be returned.
The method extractModuleName is just added and tested, it's not yet used by
the module manager.

ENH: SlicerQT - Added qCTKBinaryFileDescriptor classes - Available only under unix-like system - Allows to retrieve global symbol from executable.
Based on ModuleDescriptionParser/BinaryFileDescriptor.h

BUG: When a singleton node is "added", it is technically not added but copied to an already existing singleton node of the same class/singletonTag if it exists. In that case, we don't fire the NodeAboutToBeAdded/NodeAdded events.

ENH: SlicerQt: expose the priority property to qVTKObjects when creating connections. Applied to qMRMLSceneModel, the priority is used to update the qMRMLSceneModel internal data as soon as the NodeIsAdded/Removed event is fired. This is a way (and not the only/best one) to handle the situation where a node is added/removed when another node is added/removed: We update the internal state of qMRMLSceneModel as soon as possible.

ENH: SlicerQt: Port Load/Import Scene dialogs into Qt (mrml scenes and xml scenes). Modules can implement readers/writers that can be registered into qSlicerCoreIOManager. Custom dialogs for custom types can be designed and registered into qSlicerIOManager.

BUG: fixed some bugs in the code and tested. Clears out space in TempDir and CacheDir unless it finds a read-only file (currently stops deleting files in the dir when it encounters this permission setting as noted in VTK's SystemTools.cxx RemoveFile method) and starts up with the NoModules setting, if the write file test fails.

BUG: merge from trunk: add new method to lookup the standard VTK event numbers for strings (like ModifiedEvent). This was required because the vtkCommand list of events was edited such that the old numbers were no longer valid

BUG: migrated from trunk: follow on fix to bugs 591 and 611. When the AddArchetypeVolume tries to read a vtkMRMLVectorVolume we need to let it go through (but 591) but I believe the current code will also work for but 611, where a tensor volume should not be allowd to read into a scalar volume node

BUG: addressing bug #585; changes made to address a request by Ron in the Editor GUI panel in the trunk make this bug go away in the release branch, so I'll check it in here too. Uses different widgets in the Volumes frame

BUG: fixing bug 572, removing the pointer to the list node, use the ID to get the active one first in all cases. Clear out the list box if the id is null. Fixed some indentation, added a null check on a pointer. TODO: figure out memory leak with observer manager.

ENH: merged info from the Slicer trunk into the NCI branch to try to enable iPython in the NCI branch. Basically updated many modules of the slicer source. It will cause a rebuild. This also fixed the CellSegmentation crash (and that is why I am pushing the update).

ENH: first version of cell wall segment module (Dean's algorithm) integrated with Slicer. This version only loads the file and runs the 2D segmentation. No results are displayed yet. Fiducials are being accessed, but not fed to the algorithm yet.

BUG: It appears that the problem with the resizing
of the notebook is that the UserInterfacePanel that
is used does not fill in both the X and Y directions.
TO get around this limitation a call to
SetMinimumHeight() for our noteboot was added that
will expand the notebook beyond the typical size that
is needed.

ENH: Added 10,10 interactor size fix support in EditBBGroup since this problem showed up in RHEL 5.0 even with a fresh VTK-5-2 checkout. Added black background to the states the module sets and restores upon entry/exit.

ENH: Improved Enter/Exit commands on meshing module restore the state of meshing axes and view. Users of meshing module won't have to learn as many of the slicer controls initially this way. More work still needed on adding and removing the ApplicationSettings Interface.

ENH: fixed the initialization state of the full/subset selection button: To be consistent with standalone version, this needed its selection set off initially. Tested widget modes for partial selection, assigning material properties and boundary conditions, etc.

BUG: meshing menus weren't redrawing - so added ForceWidgetRedraw() method at the MimxMainWindow and added this to the UpdateEnableState methods for MimxGroupBase and MimxMenuGroup so it is invoked whenever UI panels need to change their state.

BUG: missing a CMakeLists.txt file in the meshing directory; also changed the Slicer tag in slicer_variables to point to the v-1-1 meshing branch so getbuildtest runs won't change it back to the trunk.

ENH: using var containing GUI's current layout instead of MRML var for GUI's previous layout (intend to back this thing out of vtkMRMLLayoutNode eventually) to determine how to unpack and repack the layout.

ENH: fixed packing bug for CompareView. This is a temporary fix marked with TODO's in the code that will need to be addressed when we finally represent compareView in the vtkMRMLLayoutNode. Right now it's not saved in state, but the packing is less messy.

ENH - making vtkMRMLUnstructuredGridNode and correspoding display and storage nodes subclasses of Model. Modified Base/vtkSlicerModelLogic to look for and read unstructured grid datasets. Display works but loading from a file doesn't correctly initialize the display node yet.

ENH - working through basic meshing workflow (forward only). Not able to delete items because IDs don't match, so this commit is in advance of alternate implementation of the MRML nodes and the linked list wrapper.

BUG - using shared access to datastructures now betwen IaFeMesh and slicer. Removed deep copies and finding that changes to bblock editing works now. Still getting duplicate entries in MRML for some reason.

ENH - added building block and Meshing data structure support in Slicer. A simple case works all the way through. Now debug why multiple bblock and meshes are added and refine UGrid rendering in slicer.

BUG: in the change to QdecModule becoming a LoadableModule, the viewer widget and interactor style were not getting set. Subclass the SetApplicationGUI method to set these pointers so that plot events can be observed

BUG: slices are now visible in 3D main viewer based on the current view arrangement, i.e., compareview mode is different from other view mode.
FEA: 3D main viewer is cleared during mode switching between compareview and other view modes

ENH - adding 2nd version of Univ. of Iowa Meshing Module to Slicer. This is an ongoing integration effort. This version is the first commit of the new codebase, which only supports the initial GUI and loads a surface file into local lists. Doing the commit one library at a time to work out the text problems (spaces, tabs, dos-newlines, etc.).

ENH - adding 2nd version of Univ. of Iowa Meshing Module to Slicer. This is an ongoing integration effort. This version is the first commit of the new codebase, which only supports the initial GUI and loads a surface file into local lists. Doing the commit one library at a time to work out the text problems (spaces, tabs, dos-newlines, etc.).

ENH - adding 2nd version of Univ. of Iowa Meshing Module to Slicer. This is an ongoing integration effort. This version is the first commit of the new codebase, which only supports the initial GUI and loads a surface file into local lists. Doing the commit one library at a time to work out the text problems (spaces, tabs, dos-newlines, etc.).

ENH - adding 2nd version of Univ. of Iowa Meshing Module to Slicer. This is an ongoing integration effort. This version is the first commit of the new codebase, which only supports the initial GUI and loads a surface file into local lists. Doing the commit one library at a time to work out the text problems (spaces, tabs, dos-newlines, etc.).

ENH - adding 2nd version of Univ. of Iowa Meshing Module to Slicer. This is an ongoing integration effort. This version is the first commit of the new codebase, which only supports the initial GUI and loads a surface file into local lists. Doing the commit one library at a time to work out the text problems (spaces, tabs, dos-newlines, etc.).

ENH - adding 2nd version of Univ. of Iowa Meshing Module to Slicer. This is an ongoing integration effort. This version is the first commit of the new codebase, which only supports the initial GUI and loads a surface file into local lists. Doing the commit one library at a time to work out the text problems (spaces, tabs, dos-newlines, etc.).

ENH - adding 2nd version of Univ. of Iowa Meshing Module to Slicer. This is an ongoing integration effort. This version is the first commit of the new codebase, which only supports the initial GUI and loads a surface file into local lists. Doing the commit one library at a time to work out the text problems (spaces, tabs, dos-newlines, etc.).

ENH - adding 2nd version of Univ. of Iowa Meshing Module to Slicer. This is an ongoing integration effort. This version is the first commit of the new codebase, which only supports the initial GUI and loads a surface file into local lists.

ENH: don't let the vtkKWRenderWidget do automatic renders for situatios like changes to the annotations - instead only render when the vtkSlicerSliceViewer wants to render (after idle). Also explicily handle expose events in the SliceSWidget that were previously handled automatically by the vtkKWRenderWidget

BUG: MemoryAllocation bug fixed. Now the 3D image is loaded correctly onto the Cuda Card.
BUG: Fixed another bug related that filled the lowest row of the model with useless data
GetActualMemorySize is actualy not the actualmemorysize... who would have guessed that, but hey, it is opensource, maybe I should have read the whole source to get tto know this :)