Happy Children’s Day.
In fact, there are three problems.
At first, my develop environment lists below.
os:ubuntu 16.04.3
slicer:latest stable version 4.8.1
lauguage:python 3.6.4
1.
I met a demand of programming a script to get a roi from someone not familiar with the slicer.
A clear guide for all processes is needed.
I have a segmentation procedure.I got the plan as follows:
step1:
using the Paint effect to get a ROI.
step2:
using the ‘Threshold’ effect to generate the segmentation.
I have tried using the markups while the coordinate is the ‘world’ not the index for array-computing.
It didn’t work well.
I’m not good enough in c++ programming.And when I use python scripts as follows:
exec_outside = ['python', '/home/cyan/PycharmProjects/adc/compute_model.py', str(flair_path)]
subprocess_status = check_output(exec_outside, shell=True, env=slicer.util.startupEnvironment())
the slicer become black and won’t wake up anymore.
2mins later ,I use htop command and find the cou is free.slicer is not on working.
the python script can work well using the same command in the bash shell within 5secs.
How could I use the subprocess module?
when I try my own algorithm for computing the adc using dwi data
# adc = np.ones(dwi_200.shape)
# adc[(dwi_200 < noise_threshold) | (dwi_2000 < noise_threshold)] = 0
# effective = adc==1
# ineffective = adc==0
# dwi_2000[ineffective] = 1
# dwi_200[ineffective] = 1
# adc[effective] = np.log(dwi_200[effective] / dwi_2000[effective]) / 1800
the slicer python-interface gives me a runtimeerror said divide 0
while this script can work well in my own python 3.6.4 env within 1 sec.
I’m confused how slicer using the cpu.
And final, I have no idea how to add a model in the right position on a mrml scene.
That to say , when I generate model using out-slicer computation(I can get the spacing,origin and the 3*3 matrix direction params using simpleITK),How can I transform the model in a loaded and mastered slicer mrmlscene?
Sincerely,
waiting for your reply.