BUG: fix memory leak of vtkCollection

Clear and delete the node collection to remove a memory leak
from the snapshot dialog.

Fixes Issue #3314



git-svn-id: http://svn.slicer.org/Slicer4/trunk@22324 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: 2816. Made data present in SceneViews to be stored in MRB file even if not present in the main scene.
 Restructured vtkMRMLApplicationLogic::SaveSceneToSlicerDataBundleDirectory() code, made it more modular.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22325 3bd1e089-480b-0410-8dfb-8563597acbee
COMP: Fixed build error in vtkMRMLApplicationLogic

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22326 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fixed gcc compile error. Removed redundant 'extension' argument

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22327 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: 2816. Store SceneViews data in MRB file even if not present in the main scene for the case when the Scene Views are read from the scene file, the data pointer is NULL in this case.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22328 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Editing laodable names in DICOM widget can now lead to renaming of
the loaded loadables.

Closes #3284

From: Alireza Mehrtash <mehrtash@bwh.harvard.edu>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22329 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: #3284 don't let user edit some dicom fields

As of r22329 the name of the volume can be set via the table widget,
but editing the other fields makes no sense, so we disable it.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22330 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: show the color indices rather than row number

The Color GUI was showing a row number starting from 1
when displaying color table entries, which are 0 indexed.
This led to a mismatch between the value shown in the
data probe (and in the actual color node) versus
what the user was being shown to be the color index.

Overloaded the headerData method to, in the case of the
vertical header display role to return the row index
minus 1. The MRML color model defines a ColorEntryRole
but it's still off by 1 from the color index.

Testing of copying a color node exposed the fact that the
new color node was not showing up in the Data module nor
in the Save Data dialog, so updated CopyNode in the color
logic to turn off the hide from editors flag on the new node.

Issue #1892


git-svn-id: http://svn.slicer.org/Slicer4/trunk@22331 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: confirm delete of markups

Add a message box to tell the user how many markups they
are about to delete and let them cancel. Option to
not show the message again.

COMP: cleaned up unused variable warnings

Fixes issue #3324



git-svn-id: http://svn.slicer.org/Slicer4/trunk@22332 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: remove fiducial settings from the tutorial self test GUI

Remove left over code from copying the add many fiducials self test.
Replaced them with screen shot parameters to help with making the tutorial,
a check box to turn them on (off by default) and a slider to set the scale
(1 by default).
Tweaked the test: make sure that the fiducial list is named the same
as when a user would create one. Make the slices visible in 3D.

Issue #3328



git-svn-id: http://svn.slicer.org/Slicer4/trunk@22333 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: #3315 allow editor extensions to define custom cursor

The mechanism for editor extensions to declare their cursor had
already existed, but it was being ignored.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22334 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fix serialization of display node representation property

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22335 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Exposes RepresentationType and InterpolationType enums to python

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22336 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Consider specific file writer before generic one.

Ideally the file reader/writer should be reworked to have a more
consistent API. More specifically after the user select a file type
in the "save dialog", the corresponding "file writer id" should be
passed down the qSlicerCoreIOManager::saveScene/saveNodes methods.

This would prevent confusion for the user. Indeed, if a writer fails a
clear error message would be displated and the system wouldn't try an other
possible writer.

See issue #3322

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22337 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Add qSlicerScriptedFileWriter interface

User can now register python based file writer.

For example:

# File MyCustomSceneExporter.py

import json
import os
import zipfile
import contextlib
import datetime
import vtk, slicer

class MyCustomSceneExporter:
  def __init__(self, parent):
    parent.title = "[...]"
    parent.categories = ["..."]
    parent.dependencies = []
    parent.contributors = ["..."]
    parent.helpText = """[...]"""
    parent.acknowledgementText = """[...]"""
    self.parent = parent

class MyCustomSceneExporterFileWriter:
    def __init__(self, parent):
        self.parent = parent

    def description(self):
        return 'Custom Scene File'

    def fileType(self):
        return 'SceneFile'

    def canWriteObject(self, obj):
        return isinstance(obj, slicer.vtkMRMLScene)

    def extensions(self, obj):
        return ['CustomScene File (*.customscene.zip)']

    def write(self, properties):
        self.exportModels(properties['fileName'])
        return True

    [...]

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22338 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: stop the dropping of fiducials dragged outside of 2d viewport

Check if the viewport coordinates have been restricted as well as if the display
coordinates were changed, as the second check wasn't fine grained enough
to detect when a restriction was made on a slow/small drag outside
of the viewport. This would lead to the fiducial being dropped
when it was outside the viewport.
Now the fiducial is stopped at the edge of the 2d viewport. When the
mouse comes back toward the view port, there is an offset between the
mouse position and the moving fiducial, but barring more user feedback,
we decided to leave this as is.

Issue #3318


git-svn-id: http://svn.slicer.org/Slicer4/trunk@22339 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: remove debugging print out, fix doc category

Remove a qDebug call that is just informational about
the system settings for the markups.
Change the documentation category to Informatics.

Issue #2740



git-svn-id: http://svn.slicer.org/Slicer4/trunk@22340 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Fix authorship of qSlicerScriptedFileWriter

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22341 3bd1e089-480b-0410-8dfb-8563597acbee
COMP: Add macro "slicerMacroBuildLoadableModule"

Both macros "slicerMacroBuildQtModule" and "slicerMacroBuildLoadableModule"
can be used. At this point, no warning message is displayed if the
deprecated macro is used.

Fixes #2648

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22342 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: 3241 Fix transform not applied to volume when scene is read from a file

When a scene is loaded, vtkMRMLScene::UpdateNodeReferences doesn't handle event registration.
Except for vtkCommand::ModifiedEvent, any other events need to be registered via OnNodeReferenceAdded API.
Fixes #3241

From: Yuzheng Zhou <yuzheng.zhou@kitware.com>

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