Skip to content

Commit

Permalink
alt rotation works
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanzongcai committed Jul 23, 2018
1 parent 91aeb5a commit ecd263e
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 69 deletions.
2 changes: 2 additions & 0 deletions nmake_release.bat
Expand Up @@ -8,6 +8,8 @@ cd ..\..\..
cd v3d_main\v3d
call ..\..\qmake -v
call ..\..\qmake vaa3d_msvc.pro

copy/b v3d_version_info.cpp+,,
nmake -f Makefile.Release

cd release
Expand Down
4 changes: 2 additions & 2 deletions v3d_main/3drenderer/renderer.cpp
Expand Up @@ -15,9 +15,9 @@ You will ***have to agree*** the following terms, *before* downloading/using/run
2. You agree to appropriately cite this work in your related studies and publications.
Peng, H., Ruan, Z., Long, F., Simpson, J.H., and Myers, E.W. (2010) V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets, Nature Biotechnology, Vol. 28, No. 4, pp. 348-353, DOI: 10.1038/nbt.1612. ( http://penglab.janelia.org/papersall/docpdf/2010_NBT_V3D.pdf )
Peng, H., Ruan, Z., Long, F., Simpson, J.H., and Myers, E.W. (2010) V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets, Nature Biotechnology, Vol. 28, No. 4, pp. 348-353, DOI: 10.1038/nbt.1612. ( http://penglab.janelia.org/papersall/docpdf/2010_NBT_V3D.pdf )
Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction of 3D neuron structures using a graph-augmented deformable model, Bioinformatics, Vol. 26, pp. i38-i46, 2010. ( http://penglab.janelia.org/papersall/docpdf/2010_Bioinfo_GD_ISMB2010.pdf )
Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction of 3D neuron structures using a graph-augmented deformable model, Bioinformatics, Vol. 26, pp. i38-i46, 2010. ( http://penglab.janelia.org/papersall/docpdf/2010_Bioinfo_GD_ISMB2010.pdf )
3. This software is provided by the copyright holders (Hanchuan Peng), Howard Hughes Medical Institute, Janelia Farm Research Campus, and contributors "as is" and any express or implied warranties, including, but not limited to, any implied warranties of merchantability, non-infringement, or fitness for a particular purpose are disclaimed. In no event shall the copyright owner, Howard Hughes Medical Institute, Janelia Farm Research Campus, or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; reasonable royalties; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
Expand Down
4 changes: 2 additions & 2 deletions v3d_main/3drenderer/renderer.h
Expand Up @@ -15,9 +15,9 @@ You will ***have to agree*** the following terms, *before* downloading/using/run
2. You agree to appropriately cite this work in your related studies and publications.
Peng, H., Ruan, Z., Long, F., Simpson, J.H., and Myers, E.W. (2010) V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets, Nature Biotechnology, Vol. 28, No. 4, pp. 348-353, DOI: 10.1038/nbt.1612. ( http://penglab.janelia.org/papersall/docpdf/2010_NBT_V3D.pdf )
Peng, H., Ruan, Z., Long, F., Simpson, J.H., and Myers, E.W. (2010) V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets, Nature Biotechnology, Vol. 28, No. 4, pp. 348-353, DOI: 10.1038/nbt.1612. ( http://penglab.janelia.org/papersall/docpdf/2010_NBT_V3D.pdf )
Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction of 3D neuron structures using a graph-augmented deformable model, Bioinformatics, Vol. 26, pp. i38-i46, 2010. ( http://penglab.janelia.org/papersall/docpdf/2010_Bioinfo_GD_ISMB2010.pdf )
Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction of 3D neuron structures using a graph-augmented deformable model, Bioinformatics, Vol. 26, pp. i38-i46, 2010. ( http://penglab.janelia.org/papersall/docpdf/2010_Bioinfo_GD_ISMB2010.pdf )
3. This software is provided by the copyright holders (Hanchuan Peng), Howard Hughes Medical Institute, Janelia Farm Research Campus, and contributors "as is" and any express or implied warranties, including, but not limited to, any implied warranties of merchantability, non-infringement, or fitness for a particular purpose are disclaimed. In no event shall the copyright owner, Howard Hughes Medical Institute, Janelia Farm Research Campus, or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; reasonable royalties; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
Expand Down
5 changes: 3 additions & 2 deletions v3d_main/3drenderer/renderer_gl1.h
Expand Up @@ -15,9 +15,9 @@ You will ***have to agree*** the following terms, *before* downloading/using/run
2. You agree to appropriately cite this work in your related studies and publications.
Peng, H., Ruan, Z., Long, F., Simpson, J.H., and Myers, E.W. (2010) V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets, Nature Biotechnology, Vol. 28, No. 4, pp. 348-353, DOI: 10.1038/nbt.1612. ( http://penglab.janelia.org/papersall/docpdf/2010_NBT_V3D.pdf )
Peng, H., Ruan, Z., Long, F., Simpson, J.H., and Myers, E.W. (2010) V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets, Nature Biotechnology, Vol. 28, No. 4, pp. 348-353, DOI: 10.1038/nbt.1612. ( http://penglab.janelia.org/papersall/docpdf/2010_NBT_V3D.pdf )
Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction of 3D neuron structures using a graph-augmented deformable model, Bioinformatics, Vol. 26, pp. i38-i46, 2010. ( http://penglab.janelia.org/papersall/docpdf/2010_Bioinfo_GD_ISMB2010.pdf )
Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction of 3D neuron structures using a graph-augmented deformable model, Bioinformatics, Vol. 26, pp. i38-i46, 2010. ( http://penglab.janelia.org/papersall/docpdf/2010_Bioinfo_GD_ISMB2010.pdf )
3. This software is provided by the copyright holders (Hanchuan Peng), Howard Hughes Medical Institute, Janelia Farm Research Campus, and contributors "as is" and any express or implied warranties, including, but not limited to, any implied warranties of merchantability, non-infringement, or fitness for a particular purpose are disclaimed. In no event shall the copyright owner, Howard Hughes Medical Institute, Janelia Farm Research Campus, or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; reasonable royalties; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
Expand Down Expand Up @@ -141,6 +141,7 @@ class Renderer_gl1 : public Renderer
//protected:
virtual void setMarkerSpace();
virtual void drawMarker(); // called by paint(), not by drawObj()
virtual void MarkerSpaceToNormalizeSpace(XYZ & p);

virtual void setSurfaceStretchSpace();
virtual void setObjLighting();
Expand Down
105 changes: 46 additions & 59 deletions v3d_main/3drenderer/renderer_hit.cpp
Expand Up @@ -1388,27 +1388,8 @@ int Renderer_gl1::processHit(int namelen, int names[], int cx, int cy, bool b_me
{
const ImageMarker & m = listMarker.at(tmpind);
XYZ p = XYZ(m);
p.x = p.x*thicknessX -strat1;
p.y = p.y*thicknessY -strat2;
p.z = p.z*thicknessZ -strat3;

BoundingBox & BB = boundingBox;
float DX = BB.Dx();
float DY = BB.Dy();
float DZ = BB.Dz();
float maxD = BB.Dmax();
double s[3];
s[0] = 1/maxD *2;
s[1] = 1/maxD *2;
s[2] = 1/maxD *2;
double t[3];
t[0] = -BB.x0 -DX /2;
t[1] = -BB.y0 -DY /2;
t[2] = -BB.z0 -DZ /2;

p.x = s[0]*(p.x +t[0]);
p.y = s[1]*(p.y +t[1]);
p.z = s[2]*(p.z +t[2]);

MarkerSpaceToNormalizeSpace(p);
qDebug("normalized alt rotation center: (%f %f %f)", p.x, p.y, p.z);

w->setAltCenter(p.x, p.y, p.z);
Expand Down Expand Up @@ -4270,6 +4251,7 @@ void Renderer_gl1::_MarkerPos_to_NearFarPoint(const MarkerPos & pos, XYZ &loc0,
loc0 = XYZ(Z0(1), Z0(2), Z0(3));
loc1 = XYZ(Z1(1), Z1(2), Z1(3));
}

double Renderer_gl1::distanceOfMarkerPos(const MarkerPos & pos0, const MarkerPos & pos)
{
XYZ Y1, Y2;
Expand Down Expand Up @@ -4303,6 +4285,7 @@ double Renderer_gl1::distanceOfMarkerPos(const MarkerPos & pos0, const MarkerPos
// double dist = fabs(x0*L.x + y0*L.y + L.z)/sqrt(L.x*L.x + L.y*L.y);
// return dist;
}

XYZ Renderer_gl1::getLocationOfListMarkerPos()
{
int N = listMarkerPos.size();
Expand Down Expand Up @@ -4339,6 +4322,7 @@ XYZ Renderer_gl1::getLocationOfListMarkerPos()
XYZ loc(X(1), X(2), X(3));
return loc;
}

XYZ Renderer_gl1::getPointOnPlane(XYZ P1, XYZ P2, double plane[4]) //100731
{
// A*N + d
Expand All @@ -4349,6 +4333,7 @@ XYZ Renderer_gl1::getPointOnPlane(XYZ P1, XYZ P2, double plane[4]) //100731
XYZ loc = P1 + t*(P2-P1);
return loc;
}

// in Image space (model space)
XYZ Renderer_gl1::getPointOnSections(XYZ P1, XYZ P2, double F_plane[4]) //100801
{
Expand All @@ -4359,47 +4344,48 @@ XYZ Renderer_gl1::getPointOnSections(XYZ P1, XYZ P2, double F_plane[4]) //100801
loc = getPointOnPlane(P1,P2, plane); \
if (dist_L2(loc,P2) > dist_L2(P,P2) && dataViewProcBox.isInner(loc, 0.5)) \
P = loc; \
}
}
//qDebug(" P1(%g %g %g) P2(%g %g %g)", P1.x,P1.y,P1.z, P2.x,P2.y,P2.z);
if (bXSlice)
{
plane[0] = -1; plane[1] = 0; plane[2] = 0; plane[3] = start1+ VOL_X0*(size1-1);
REPLACE_NEAR( plane );
//qDebug(" X-(%g %g %g)", loc.x,loc.y,loc.z);
}
if (bYSlice)
{
plane[0] = 0; plane[1] = -1; plane[2] = 0; plane[3] = start2+ VOL_Y0*(size2-1);
REPLACE_NEAR( plane );
//qDebug(" Y-(%g %g %g)", loc.x,loc.y,loc.z);
}
if (bZSlice)
{
plane[0] = 0; plane[1] = 0; plane[2] = -1; plane[3] = start3+ VOL_Z0*(size3-1);
REPLACE_NEAR( plane );
//qDebug(" Z-(%g %g %g)", loc.x,loc.y,loc.z);
}
if (bFSlice)
{
if (F_plane)
for (int i=0; i<4; i++) plane[i] = F_plane[i];
else
if (bXSlice)
{
////////////////////////////////////////////////////////////////////////
//100730 RZC, in View space, keep for dot(clip, pos)>=0
double clipplane[4] = { 0.0, 0.0, -1.0, 0 };
clipplane[3] = viewClip;
ViewPlaneToModel(markerViewMatrix, clipplane);
//qDebug()<<" clipplane:"<<clipplane[0]<<clipplane[1]<<clipplane[2]<<clipplane[3];
////////////////////////////////////////////////////////////////////////
for (int i=0; i<4; i++) plane[i] = clipplane[i];
}
REPLACE_NEAR( plane );
//qDebug(" F-(%g %g %g)", loc.x,loc.y,loc.z);
}
//qDebug(" P(%g %g %g)", P.x,P.y,P.z);
return P;
plane[0] = -1; plane[1] = 0; plane[2] = 0; plane[3] = start1+ VOL_X0*(size1-1);
REPLACE_NEAR( plane );
//qDebug(" X-(%g %g %g)", loc.x,loc.y,loc.z);
}
if (bYSlice)
{
plane[0] = 0; plane[1] = -1; plane[2] = 0; plane[3] = start2+ VOL_Y0*(size2-1);
REPLACE_NEAR( plane );
//qDebug(" Y-(%g %g %g)", loc.x,loc.y,loc.z);
}
if (bZSlice)
{
plane[0] = 0; plane[1] = 0; plane[2] = -1; plane[3] = start3+ VOL_Z0*(size3-1);
REPLACE_NEAR( plane );
//qDebug(" Z-(%g %g %g)", loc.x,loc.y,loc.z);
}
if (bFSlice)
{
if (F_plane)
for (int i=0; i<4; i++) plane[i] = F_plane[i];
else
{
////////////////////////////////////////////////////////////////////////
//100730 RZC, in View space, keep for dot(clip, pos)>=0
double clipplane[4] = { 0.0, 0.0, -1.0, 0 };
clipplane[3] = viewClip;
ViewPlaneToModel(markerViewMatrix, clipplane);
//qDebug()<<" clipplane:"<<clipplane[0]<<clipplane[1]<<clipplane[2]<<clipplane[3];
////////////////////////////////////////////////////////////////////////
for (int i=0; i<4; i++) plane[i] = clipplane[i];
}
REPLACE_NEAR( plane );
//qDebug(" F-(%g %g %g)", loc.x,loc.y,loc.z);
}
//qDebug(" P(%g %g %g)", P.x,P.y,P.z);
return P;
}

// in Image space (model space)
XYZ Renderer_gl1::getCenterOfLineProfile(XYZ P1, XYZ P2,
double clipplane[4], //clipplane==0 means no clip plane
Expand Down Expand Up @@ -4552,6 +4538,7 @@ int Renderer_gl1::getVolumeXsectPosOfMarkerLine(XYZ & locA, XYZ & locB, const Ma

return 1;
}

// in Image space (model space), by PHC 20130425
int Renderer_gl1::getVolumeXsectPosOfMarkerLine(XYZ P1, XYZ P2,
double clipplane[4], //clipplane==0 means no clip plane
Expand Down
35 changes: 33 additions & 2 deletions v3d_main/3drenderer/renderer_obj.cpp
Expand Up @@ -8,8 +8,8 @@ This folder contains all source codes for the V3D project, which is subject to t
You will ***have to agree*** the following terms, *before* downloading/using/running/editing/changing any portion of codes in this package.
1. This package is free for non-profit research, but needs a special license for any commercial purpose. Please contact Hanchuan Peng for details.
2. You agree to appropriately cite this work in your related studies and publications.
Peng, H., Ruan, Z., Long, F., Simpson, J.H., and Myers, E.W. (2010) V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets, Nature Biotechnology, Vol. 28, No. 4, pp. 348-353, DOI: 10.1038/nbt.1612. ( http://penglab.janelia.org/papersall/docpdf/2010_NBT_V3D.pdf )
Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction of 3D neuron structures using a graph-augmented deformable model, Bioinformatics, Vol. 26, pp. i38-i46, 2010. ( http://penglab.janelia.org/papersall/docpdf/2010_Bioinfo_GD_ISMB2010.pdf )
Peng, H., Ruan, Z., Long, F., Simpson, J.H., and Myers, E.W. (2010) V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets, Nature Biotechnology, Vol. 28, No. 4, pp. 348-353, DOI: 10.1038/nbt.1612. ( http://penglab.janelia.org/papersall/docpdf/2010_NBT_V3D.pdf )
Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction of 3D neuron structures using a graph-augmented deformable model, Bioinformatics, Vol. 26, pp. i38-i46, 2010. ( http://penglab.janelia.org/papersall/docpdf/2010_Bioinfo_GD_ISMB2010.pdf )
3. This software is provided by the copyright holders (Hanchuan Peng), Howard Hughes Medical Institute, Janelia Farm Research Campus, and contributors "as is" and any express or implied warranties, including, but not limited to, any implied warranties of merchantability, non-infringement, or fitness for a particular purpose are disclaimed. In no event shall the copyright owner, Howard Hughes Medical Institute, Janelia Farm Research Campus, or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; reasonable royalties; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
4. Neither the name of the Howard Hughes Medical Institute, Janelia Farm Research Campus, nor Hanchuan Peng, may be used to endorse or promote products derived from this software without specific prior written permission.
*************/
Expand Down Expand Up @@ -871,6 +871,37 @@ void Renderer_gl1::setMarkerSpace()
glTranslated(-start1,-start2,-start3); //090715
glScaled(thicknessX, thicknessY, thicknessZ);
}
void Renderer_gl1::MarkerSpaceToNormalizeSpace(XYZ & p)
{

p.x = p.x*thicknessX -start1;
p.y = p.y*thicknessY -start2;
p.z = p.z*thicknessZ -start3;

///Renderer::setObjectSpace()-->setBoundingBoxSpace( boundingBox );
///glScaled(s[0], s[1], s[2]);
///glTranslated(t[0], t[1], t[2]);

BoundingBox & BB = boundingBox;
float DX = BB.Dx();
float DY = BB.Dy();
float DZ = BB.Dz();
float maxD = BB.Dmax();
double s[3];
s[0] = 1/maxD *2;
s[1] = 1/maxD *2;
s[2] = 1/maxD *2;
double t[3];
t[0] = -BB.x0 -DX /2;
t[1] = -BB.y0 -DY /2;
t[2] = -BB.z0 -DZ /2;

p.x = s[0]*(p.x +t[0]);
p.y = s[1]*(p.y +t[1]);
p.z = s[2]*(p.z +t[2]);

}

void Renderer_gl1::drawMarker()
{
glPushName(stImageMarker);
Expand Down
4 changes: 2 additions & 2 deletions v3d_main/3drenderer/v3dr_glwidget.cpp
Expand Up @@ -397,8 +397,8 @@ void V3dR_GLWidget::paintGL()
//SET translation
{
//absolute translation
//XYZ T(_xShift, _yShift, _zShift); //qDebug("T= %f %f %f", T.x, T.y, T.z);
XYZ T(_xShift, _yShift, 0); // force zShift=0
XYZ T(_xShift, _yShift, _zShift); //qDebug("T= %f %f %f", T.x, T.y, T.z);
//XYZ T(_xShift, _yShift, 0); // force zShift=0
dxShift=dyShift=dzShift=0; // clear relative shift step

double s = 1.4/(float)SHIFT_RANGE; // 1.4 ~ sqrt(2);
Expand Down

0 comments on commit ecd263e

Please sign in to comment.