コード例 #1
0
 def addIsosurface(self, volumedata, level, style_object, clip_object,
                   clip_style_object):
     vb = volumedata.value_bounds
     wb = volumedata.worldbox
     difference = vb[1] - vb[0]
     if __debug__:
         print('Adding Isosuface! See if threshold is reasonable:')
         print('vb[1]-vb[0]: %f ' % difference)
     threshold = -(level - vb[0]) / difference
     if np.isnan(threshold) or np.isinf(threshold):
         threshold = -1.
     o = pv.Isosurface(
         pv.Function('-%s(x,y,z)' % (volumedata.name)),
         ['max_gradient', volumedata.max_grad],
         pv.ContainedBy(pv.Box(wb[:, 0], wb[:, 1])),
         ['threshold', threshold],
         ['all_intersections'],
         #['scale', (wb[:,1]-wb[:,0])],
         #['translate', (wb[:,0])],
     )
     o = pv.Object(o, style_object())
     if clip_object:
         s = krebsutils.povray_clip_object_str(clip_object,
                                               str(clip_style_object))
         if s:
             o = pv.Intersection(o, s)
     o.write(self.pvfile)
コード例 #2
0
        pigment {
          color rgb<1,0.5, 0.1>
        }
        finish {
          specular 0.1
          ambient 1.
        }
      }'''
        t1 = pv.Sphere((0, 0, 0), (tumRadius - shellHalfThickness) * trafo.w,
                       style)
        t2 = pv.Sphere((0, 0, 0), (tumRadius + shellHalfThickness) * trafo.w,
                       style)
        o = pv.Difference(t2, t1)
        clipStyle = "pigment { color rgb<%0.2f,%0.2f,%0.2f> }" % defaultCrossSectionColor
        clip = clipFactory(kwargs.get('tumor_clip', None))
        s = krebsutils.povray_clip_object_str(clip, clipStyle)
        if s:
            o = pv.Intersection(o, s)
        o.write(epv.pvfile)

        CallPovrayAndOptionallyMakeMPLPlot(epv, imagefn, cm, label, **kwargs)


def renderScene(po2group, imagefn, options):
    dataman = myutils.DataManager(2, [DataDetailedPO2(), DataBasicVessel()])

    gvessels, gtumor = OpenVesselAndTumorGroups(po2group)

    po2vessels, po2field_ld, po2field, parameters = dataman(
        'detailedPO2', po2group)
    po2vessels = np.average(po2vessels, axis=0)