diff --git a/src/main/kotlin/sc/iview/commands/edit/BasicProperties.kt b/src/main/kotlin/sc/iview/commands/edit/BasicProperties.kt index 27ded09e..cce88c71 100644 --- a/src/main/kotlin/sc/iview/commands/edit/BasicProperties.kt +++ b/src/main/kotlin/sc/iview/commands/edit/BasicProperties.kt @@ -30,20 +30,21 @@ package sc.iview.commands.edit import graphics.scenery.* import graphics.scenery.attribute.material.HasMaterial -import net.imagej.lut.LUTService import okio.withLock import org.joml.Quaternionf import org.joml.Vector3f import org.scijava.command.Command import org.scijava.plugin.Parameter import org.scijava.plugin.Plugin -import org.scijava.ui.UIService import org.scijava.util.ColorRGB import org.scijava.widget.ChoiceWidget import org.scijava.widget.NumberWidget import sc.iview.event.NodeChangedEvent import java.util.* +const val GROUP_NAME_BASIC = "group:Basic Properties" +const val GROUP_NAME_ROTATION = "group:Rotation & Scaling" + /** * A command for interactively editing a node's properties. * @@ -54,52 +55,45 @@ import java.util.* */ @Plugin(type = Command::class, initializer = "updateCommandFields", visible = false) class BasicProperties : InspectorInteractiveCommand() { - @Parameter - private lateinit var uiSrv: UIService - - @Parameter - private lateinit var lutService: LUTService - /* Basic properties */ @Parameter(required = false, style = ChoiceWidget.LIST_BOX_STYLE, callback = "refreshSceneNodeInDialog") private val sceneNode: String? = null - @Parameter(label = "Visible", callback = "updateNodeProperties", style = "group:Basic") + @Parameter(label = "Visible", callback = "updateNodeProperties", style = GROUP_NAME_BASIC) private var visible = false - @Parameter(label = "Color", required = false, callback = "updateNodeProperties", style = "group:Basic") - private var colour: ColorRGB? = null + @Parameter(label = "Color", required = false, callback = "updateNodeProperties", style = GROUP_NAME_BASIC) + private var color: ColorRGB? = null - @Parameter(label = "Name", callback = "updateNodeProperties", style = "group:Basic") + @Parameter(label = "Name", callback = "updateNodeProperties", style = GROUP_NAME_BASIC) private var name: String = "" - @Parameter(label = "Position X", style = NumberWidget.SPINNER_STYLE+ ",group:Basic" + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") + @Parameter(label = "Position X", style = NumberWidget.SPINNER_STYLE + "," + GROUP_NAME_BASIC + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") private var positionX = 0f - @Parameter(label = "Position Y", style = NumberWidget.SPINNER_STYLE+ ",group:Basic" + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") + @Parameter(label = "Position Y", style = NumberWidget.SPINNER_STYLE + "," + GROUP_NAME_BASIC + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") private var positionY = 0f - @Parameter(label = "Position Z", style = NumberWidget.SPINNER_STYLE+ ",group:Basic" + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") + @Parameter(label = "Position Z", style = NumberWidget.SPINNER_STYLE + "," + GROUP_NAME_BASIC + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") private var positionZ = 0f - - @Parameter(label = "[Rotation & Scaling]Scale X", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling" + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") + @Parameter(label = "Scale X", style = NumberWidget.SPINNER_STYLE + GROUP_NAME_ROTATION + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") private var scaleX = 1f - @Parameter(label = "[Rotation & Scaling]Scale Y", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling" + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") + @Parameter(label = "Scale Y", style = NumberWidget.SPINNER_STYLE + GROUP_NAME_ROTATION + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") private var scaleY = 1f - @Parameter(label = "[Rotation & Scaling]Scale Z", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling" + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") + @Parameter(label = "Scale Z", style = NumberWidget.SPINNER_STYLE + GROUP_NAME_ROTATION + ",format:0.000", stepSize = "0.1", callback = "updateNodeProperties") private var scaleZ = 1f - @Parameter(label = "[Rotation & Scaling]Rotation Phi", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling" + ",format:0.000", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties") + @Parameter(label = "Rotation Phi", style = NumberWidget.SPINNER_STYLE + GROUP_NAME_ROTATION + ",format:0.000", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties") private var rotationPhi = 0f - @Parameter(label = "[Rotation & Scaling]Rotation Theta", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling" + ",format:0.000", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties") + @Parameter(label = "Rotation Theta", style = NumberWidget.SPINNER_STYLE + GROUP_NAME_ROTATION + ",format:0.000", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties") private var rotationTheta = 0f - @Parameter(label = "[Rotation & Scaling]Rotation Psi", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling" + ",format:0.000", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties") + @Parameter(label = "Rotation Psi", style = NumberWidget.SPINNER_STYLE + GROUP_NAME_ROTATION + ",format:0.000", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties") private var rotationPsi = 0f @@ -168,7 +162,7 @@ class BasicProperties : InspectorInteractiveCommand() { else -> Vector3f(0.5f) } - colour = ColorRGB( + color = ColorRGB( (colourVector[0] * 255).toInt(), // (colourVector[1] * 255).toInt(), // (colourVector[2] * 255).toInt() @@ -209,9 +203,9 @@ class BasicProperties : InspectorInteractiveCommand() { // update colour val cVector = Vector3f( - colour!!.red / 255f, - colour!!.green / 255f, - colour!!.blue / 255f + color!!.red / 255f, + color!!.green / 255f, + color!!.blue / 255f ) if(node is PointLight) { node.emissionColor = cVector diff --git a/src/main/kotlin/sc/iview/commands/edit/ResetScene.kt b/src/main/kotlin/sc/iview/commands/edit/ResetScene.kt index 94c46781..6e1285e9 100644 --- a/src/main/kotlin/sc/iview/commands/edit/ResetScene.kt +++ b/src/main/kotlin/sc/iview/commands/edit/ResetScene.kt @@ -44,9 +44,6 @@ import sc.iview.commands.MenuWeights.EDIT_RESET_SCENE */ @Plugin(type = Command::class, menuRoot = "SciView", menu = [Menu(label = "Edit", weight = EDIT), Menu(label = "Reset Scene", weight = EDIT_RESET_SCENE)]) class ResetScene : Command { - @Parameter - private lateinit var logService: LogService - @Parameter private lateinit var sciView: SciView diff --git a/src/main/kotlin/sc/iview/commands/edit/SlicingPlaneProperties.kt b/src/main/kotlin/sc/iview/commands/edit/SlicingPlaneProperties.kt index 6dda1773..3f64b22e 100644 --- a/src/main/kotlin/sc/iview/commands/edit/SlicingPlaneProperties.kt +++ b/src/main/kotlin/sc/iview/commands/edit/SlicingPlaneProperties.kt @@ -14,12 +14,6 @@ import org.scijava.ui.UIService */ @Plugin(type = Command::class, initializer = "updateCommandFields", visible = false) class SlicingPlaneProperties : InspectorInteractiveCommand() { - @Parameter - private lateinit var uiSrv: UIService - - @Parameter - private lateinit var lutService: LUTService - /* Targets properties */ @Parameter(label = "Sliced volumes", callback = "updateNodeProperties", style = "group:Targets") private var slicedVolumes: VolumeSelectorWidget.VolumeSelection = VolumeSelectorWidget.VolumeSelection() diff --git a/src/main/kotlin/sc/iview/commands/edit/TextBoardProperties.kt b/src/main/kotlin/sc/iview/commands/edit/TextBoardProperties.kt index 33669485..aefff28c 100644 --- a/src/main/kotlin/sc/iview/commands/edit/TextBoardProperties.kt +++ b/src/main/kotlin/sc/iview/commands/edit/TextBoardProperties.kt @@ -43,6 +43,8 @@ class TextBoardProperties : InspectorInteractiveCommand() { node.backgroundColor.z().toInt() * 255 ) transparentBackground = node.transparent > 0 + + maybeRemoveInput("color", ColorRGB::class.java) } } diff --git a/src/main/kotlin/sc/iview/commands/edit/VolumeProperties.kt b/src/main/kotlin/sc/iview/commands/edit/VolumeProperties.kt index b6d6e646..20c5e5c6 100644 --- a/src/main/kotlin/sc/iview/commands/edit/VolumeProperties.kt +++ b/src/main/kotlin/sc/iview/commands/edit/VolumeProperties.kt @@ -1,28 +1,21 @@ package sc.iview.commands.edit import graphics.scenery.volumes.Volume -import net.imagej.lut.LUTService import okio.withLock import org.scijava.ItemVisibility import org.scijava.command.Command import org.scijava.plugin.Parameter import org.scijava.plugin.Plugin -import org.scijava.ui.UIService import org.scijava.widget.Button import org.scijava.widget.ChoiceWidget import org.scijava.widget.NumberWidget +const val PLAY_PAUSE_BUTTON_NAME = "playPause" /** * Inspector panel for [Volume] nodes. */ @Plugin(type = Command::class, initializer = "updateCommandFields", visible = false) class VolumeProperties : InspectorInteractiveCommand() { - @Parameter - private lateinit var uiSrv: UIService - - @Parameter - private lateinit var lutService: LUTService - /* Basic properties */ @Parameter(required = false, style = ChoiceWidget.LIST_BOX_STYLE, callback = "refreshSceneNodeInDialog") @@ -62,6 +55,7 @@ class VolumeProperties : InspectorInteractiveCommand() { } /** Plays a volume time series, if the volume has more than one timepoint. */ + @Suppress("unused") fun playTimeSeries() { if (currentSceneNode !is Volume) { return @@ -85,7 +79,7 @@ class VolumeProperties : InspectorInteractiveCommand() { } } } - info.getMutableInput("playPauseButton", Button::class.java).label = "Pause" + info.getMutableInput(PLAY_PAUSE_BUTTON_NAME, Button::class.java).label = "Pause" timeSeriesPlayer!!.start() } else { try { @@ -94,7 +88,7 @@ class VolumeProperties : InspectorInteractiveCommand() { e.printStackTrace() } timeSeriesPlayer = null - info.getMutableInput("playPauseButton", Button::class.java).setLabel("Play") + info.getMutableInput(PLAY_PAUSE_BUTTON_NAME, Button::class.java).setLabel("Play") } } @@ -126,7 +120,7 @@ class VolumeProperties : InspectorInteractiveCommand() { // reverts to the Kotlin types and you'll end up with interesting error messages // like "float does not match type float" ;-) maybeRemoveInput("timepoint", java.lang.Integer::class.java) - maybeRemoveInput("playPauseButton", Button::class.java) + maybeRemoveInput(PLAY_PAUSE_BUTTON_NAME, Button::class.java) maybeRemoveInput("playSpeed", java.lang.Integer::class.java) } }