Skip to content
Snippets Groups Projects
Commit 9ababd6b authored by marco's avatar marco
Browse files

fix data viewer selection for 3 dimensional images

The selection was ignoring the active slab and as a result, the
normalization did not work as expected.

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2675 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 0e4c3de4
Branches
Tags
No related merge requests found
......@@ -93,3 +93,13 @@ def Correl(xs, ys):
sigma_x=math.sqrt(sigma_x/len(xs))
sigma_y=math.sqrt(sigma_y/len(ys))
return cross_term/((len(xs)-1)*sigma_x*sigma_y)
def Histogram(xs, bounds, num_bins):
bins=[0 for i in range(num_bins)]
d=1.0*num_bins/(bounds[1]-bounds[0])
for x in xs:
index=int((x-bounds[0])*d)
if index>num_bins-1 or index<0:
continue
bins[index]+=1
return bins
......@@ -554,9 +554,9 @@ void DataViewerPanelBase::mouseMoveEvent(QMouseEvent* event)
Point max_pos=WinToPoint(vsize.width(),vsize.height());
Point min_pos=WinToPoint(0,0);
selection_=Extent(Point(std::max(min_pos[0],std::min(drag_start[0],mouse_pos[0])),
std::max(min_pos[1],std::min(drag_start[1],mouse_pos[1]))),
std::max(min_pos[1],std::min(drag_start[1],mouse_pos[1])), slab_),
Point(std::max(drag_start[0],std::min(max_pos[0],mouse_pos[0])),
std::max(drag_start[1],std::min(max_pos[1],mouse_pos[1]))));
std::max(drag_start[1],std::min(max_pos[1],mouse_pos[1])), slab_));
if(selection_mode_>0){
Size s=selection_.GetSize();
int minsize=std::min<int>(s[0],s[1]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment