@@ -34,6 +34,7 @@ import org.scijava.plugin.Parameter
3434import org.scijava.plugin.Plugin
3535import org.scijava.ui.UIService
3636import org.scijava.widget.FileWidget
37+ import sc.iview.SciView
3738import sc.iview.SciViewService
3839import sc.iview.commands.MenuWeights
3940import sc.iview.process.MeshConverter
@@ -42,8 +43,8 @@ import java.io.IOException
4243
4344typealias NeuronsAndImage = Triple <HashMap <Long , Long >, RandomAccessibleInterval <UnsignedLongType >, RandomAccessibleInterval <UnsignedByteType >>
4445
45- @Plugin(type = Command ::class , label = " Cremi Dataset rendering demo" , menuRoot = " SciView" , menu = [Menu (label = " Demo" , weight = MenuWeights .DEMO ), Menu (label = " Cremi" , weight = MenuWeights .DEMO_VOLUME_RENDER )])
46- class CremiDemo : Command {
46+ @Plugin(type = Command ::class , label = " Cremi Dataset rendering demo" , menuRoot = " SciView" , menu = [Menu (label = " Demo" , weight = MenuWeights .DEMO ), Menu (label = " Load Cremi dataset and neuron labels " , weight = MenuWeights .DEMO_VOLUME_RENDER )])
47+ class LoadCremiDatasetAndNeurons : Command {
4748 @Parameter
4849 private lateinit var ui: UIService
4950
@@ -54,7 +55,7 @@ class CremiDemo : Command {
5455 private lateinit var ops: OpService
5556
5657 @Parameter
57- private lateinit var sciview: SciViewService
58+ private lateinit var sciview: SciView
5859
5960 @Parameter
6061 private lateinit var lut: LUTService
@@ -106,15 +107,19 @@ class CremiDemo : Command {
106107 cursor.get().set(0 )
107108 }
108109
109- val volume = sciview.activeSciView. addVolume(nai.third, files.first().name) as ? Volume
110+ val volume = sciview.addVolume(nai.third, files.first().name) as ? Volume
110111 volume?.origin = Origin .FrontBottomLeft
111112 volume?.scale = Vector3f (0.04f , 0.04f , 2.5f )
112113 volume?.transferFunction = TransferFunction .ramp(0.3f , 0.1f , 0.1f )
113114 // min 20, max 180, color map fire
114- volume?.converterSetups?.get(0 )?.setDisplayRange(20.0 , 180.0 )
115- val colormap = lut.loadLUT(lut.findLUTs().get(" Fire.lut" ))
115+ volume?.transferFunction?.addControlPoint(0.8f , 0.01f )
116+ volume?.converterSetups?.get(0 )?.setDisplayRange(20.0 , 220.0 )
117+ val colormap = lut.loadLUT(lut.findLUTs().get(" Grays.lut" ))
118+ val colormapNeurons = lut.loadLUT(lut.findLUTs().get(" Fire.lut" ))
119+
116120 volume?.colormap = Colormap .fromColorTable(colormap)
117121
122+
118123 val rai = nai.second
119124 log.info(" Got ${nai.first.size} labels" )
120125
@@ -127,7 +132,7 @@ class CremiDemo : Command {
127132 val regions = LabelRegions (labeling)
128133 log.info(" Created ${regions.count()} regions" )
129134
130- val largestNeuronLabels = nai.first.entries.sortedByDescending { p -> p.value }.take(10 ).map { kv -> kv.key }
135+ val largestNeuronLabels = nai.first.entries.sortedByDescending { p -> p.value }.take(50 ).shuffled().take( 10 ).map { kv -> kv.key }
131136
132137 log.info(" Largest neuron labels are ${largestNeuronLabels.joinToString(" ," )} " )
133138
@@ -141,13 +146,13 @@ class CremiDemo : Command {
141146 // Convert the mesh into a scenery mesh for visualization
142147 val mesh = MeshConverter .toScenery(m, false )
143148 mesh.scale = Vector3f (0.01f , 0.01f , 0.06f )
144- mesh.material.diffuse = colormap .lookupARGB(0.0 , 255.0 , kotlin.random.Random .nextDouble(0.0 , 255.0 )).toRGBColor().xyz()
149+ mesh.material.diffuse = colormapNeurons .lookupARGB(0.0 , 255.0 , kotlin.random.Random .nextDouble(0.0 , 255.0 )).toRGBColor().xyz()
145150 mesh.material.roughness = 0.0f
146151
147152 // marching cubes produces CW meshes, not CCW as expected by default
148153 mesh.material.cullingMode = Material .CullingMode .Front
149154 mesh.name = " Neuron $i "
150- sciview.activeSciView. addNode(mesh)
155+ sciview.addNode(mesh)
151156 }
152157 }
153158
0 commit comments