Пример #1
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params["input"].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            volumes = self._getVols(objs)

            if len(volumes) == 0:
                return HttpResponse("errorIterate")

            params["value"] = proccessModeFilter(params["mode"], params["value"])
            params["label"] = params["label"]

            params["samplingRate"] = objs.getSamplingRate()

            itemDim, _, _ = objs.getDim()

            if params["unit"] == UNIT_ANGSTROM:
                params["min"] = 2.0 * params["samplingRate"]
                params["max"] = 2.0 * itemDim * params["samplingRate"]
            else:
                params["min"] = 0.01
                params["max"] = 0.5

            params["value"] = setValueOnRange(params["value"], params["min"], params["max"])

            context = {"objects": volumes, "params": params}

            context = base_wiz(request, context)

            return render_to_response("wizards/wiz_filter_volumes.html", context)
Пример #2
0
 def _run(self, protocol, request):
     params = self._getParameters(protocol)
     objs = params['input'].get()
     
     res = validateParticles(objs) 
     
     if res is not 1:
         return HttpResponse(res)
     else:
         particles = self._getParticles(objs)
         
         if len(particles) == 0:
             return HttpResponse("errorIterate")
         
         # getting dimension in Pixels
         xdim = getImageXdim(request, particles[0].text) 
         
         # Multiply by sampling rate to convert to angstroms
         xdim *= objs.getSamplingRate()
         
         params['value'] = validateMaskRadius(params['value'], xdim, radius=1)
         
         context = {'objects': particles,
                    'xdim': int(xdim/2),
                    'params': params}
     
         context = base_wiz(request, context)
         return render_to_response('wizards/wiz_particle_mask_radius.html', context)    
Пример #3
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            vols = self._getVols(objs)
            
            if len(vols) == 0:
                return HttpResponse("errorIterate")
            
            xdim = getImageXdim(request, vols[0].getFileName())

            # Multiply by sampling rate to convert to angstroms
            xdim *= objs.getSamplingRate()
            
            params['value'] = validateMaskRadius(params['value'], xdim, radius=2)  
            
            context = {'objects': vols,
                       'xdim': int(xdim/2),
                       'params': params}
        
            context = base_wiz(request, context)
            return render_to_response('wizards/wiz_volumes_mask_radii.html', context)    
Пример #4
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateParticles(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            particles = self._getParticles(objs)

            if len(particles) == 0:
                return HttpResponse("errorIterate")

            params['value'] = proccessModeFilter(params['mode'], params['value'])

            params['samplingRate'] = particles[1].getSamplingRate()

            itemDim,_,_ = particles[1].getDim()

            if params['unit'] == UNIT_ANGSTROM:
                params['min'] = 2.*params['samplingRate']
                params['max'] = 2.*itemDim*params['samplingRate']
            else:
                params['min'] = 0.01
                params['max'] = 0.5

            params['value'] = setValueOnRange(params['value'], params['min'], params['max'])

            context = {'objects': particles,
                       'params':params}

            context = base_wiz(request, context)

            return render_to_response('wizards/wiz_filter_particles.html', context)
Пример #5
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)

        objs = params['input'].get()

        res = validateParticles(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            particles = self._getParticles(objs)

            if len(particles) == 0:
                return HttpResponse("errorIterate")

            print "params mode", params['mode']
            params['value'] = proccessModeFilter(params['mode'],
                                                 params['value'])

            params['value'] = setValueOnRange(params['value'], 0, 0.5)

            context = {'objects': particles, 'params': params}

            context = base_wiz(request, context)

            return render_to_response('wizards/wiz_filter_spider.html',
                                      context)
Пример #6
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        
        objs = params['input'].get()
        
        res = validateParticles(objs)
        
        if res is not 1:
            return HttpResponse(res)
        else:
            particles = self._getParticles(objs)
            
            if len(particles) == 0:
                return HttpResponse("errorIterate")

            print "params mode", params['mode']
            params['value'] = proccessModeFilter(params['mode'], params['value'])

            params['value'] = setValueOnRange(params['value'], 0, 0.5)
            
            context = {'objects': particles,
                       'params':params }
            
            context = base_wiz(request, context)
            
            return render_to_response('wizards/wiz_filter_spider.html', context)
Пример #7
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            vols = self._getVols(objs)

            if len(vols) == 0:
                return HttpResponse("errorIterate")

            xdim = getImageXdim(request, vols[0].getFileName())

            params['value'] = validateMaskRadius(params['value'],
                                                 xdim,
                                                 radius=2)

            context = {'objects': vols, 'xdim': xdim / 2, 'params': params}

            context = base_wiz(request, context)
            return render_to_response('wizards/wiz_volumes_mask_radii.html',
                                      context)
Пример #8
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateParticles(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            particles = self._getParticles(objs)

            if len(particles) == 0:
                return HttpResponse("errorIterate")

            xdim = getImageXdim(request, particles[0].text)

            params['value'] = validateMaskRadius(params['value'],
                                                 xdim,
                                                 radius=1)

            context = {
                'objects': particles,
                'xdim': int(xdim / 2),
                'params': params
            }

            context = base_wiz(request, context)
            return render_to_response('wizards/wiz_particle_mask_radius.html',
                                      context)
Пример #9
0
    def _run(self, protocol, request):

        if not protocol.useSplitVolume:
            emptyInput = protocol.inputVolume.pointsNone()
        else:
            emptyInput = (protocol.volumeHalf1.pointsNone()
                          or protocol.volumeHalf2.pointsNone())

        if emptyInput:
            return HttpResponse("Error: select the input volume(s) first.")
        else:
            plotUrl, min_ang = getPlotResMap(request, protocol)

            ang = protocol.prewhitenAng.get()
            if ang < min_ang:
                ang = min_ang

            context = {
                # Params
                'ang': round(ang, 2),
                'ramp': protocol.prewhitenRamp.get(),
                # Extra Params
                'pValue': protocol.pVal.get(),
                'minRes': protocol.minRes.get(),
                'maxRes': protocol.maxRes.get(),
                'stepRes': protocol.stepRes.get(),
                # Others
                'plot': plotUrl,
                'min_ang': round(min_ang, 2),
                'messi_js': getResourceJs('messi'),
                'messi_css': getResourceCss('messi'),
            }

            if protocol.useSplitVolume:
                context.update({
                    'useSplit': 1,
                    'inputId': protocol.volumeHalf1.getUniqueId(),
                    'splitId': protocol.volumeHalf2.getUniqueId()
                })
            else:
                context.update({'inputId': protocol.inputVolume.getUniqueId()})

            if protocol.applyMask:
                if protocol.maskVolume.pointsNone():
                    return HttpResponse("Error: select the input mask first.")
                context.update({
                    'useMask': 1,
                    'maskId': protocol.maskVolume.getUniqueId()
                })

            context = base_wiz(request, context)
            return render_to_response('wizards/wiz_resmap.html', context)
Пример #10
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:

            context = {'objects': self._getMics(objs), 'params': params}

            context = base_wiz(request, context)
            return render_to_response('wizards/wiz_downsampling.html', context)
Пример #11
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params["input"].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:

            context = {"objects": self._getMics(objs), "params": params}

            context = base_wiz(request, context)
            return render_to_response("wizards/wiz_ctf_downsampling.html", context)
Пример #12
0
 def _run(self, protocol, request):
     params = self._getParameters(protocol)     
     objs = params['input'].get()
     
     res = validateSet(objs)
     
     if res is not 1:
         return HttpResponse(res)
     else:           
         
         context = {'objects': self._getMics(objs),
                    'params': params}
 
         context = base_wiz(request, context)
         return render_to_response('wizards/wiz_downsampling.html', context)
Пример #13
0
    def _run(self, protocol, request):
        
        if not protocol.inputVolume.get().hasValue():
            return HttpResponse("errorInput")
        elif protocol.useSplitVolume == True:
            if not protocol.splitVolume.get().hasValue():
                return HttpResponse("errorInput")
        else:
            plotUrl, min_ang = getPlotResMap(request, protocol)

            ang = protocol.prewhitenAng.get()
            if ang < min_ang:
                ang = min_ang
            
            context = {
                       # Params
                       'inputId': protocol.inputVolume.get().getObjId(),
                       'ang': round(ang, 2),
                       'ramp': protocol.prewhitenRamp.get(),
                       # Extra Params
                       'pValue': protocol.pVal.get(),
                       'minRes': protocol.minRes.get(), 
                       'maxRes': protocol.maxRes.get(),
                       'stepRes': protocol.stepRes.get(),
                       # Others
                       'plot': plotUrl,
                       'min_ang': round(min_ang, 2),
                       'messi_js': getResourceJs('messi'),
                       'messi_css': getResourceCss('messi'),
                       }
            
            if protocol.useSplitVolume == True and protocol.splitVolume.get().hasValue():
                context.update({'useSplit' : 1,
                                'splitId' : protocol.splitVolume.getObjId(),
                                })
           
            if protocol.applyMask == True and protocol.maskVolume.get().hasValue():
                context.update({'useMask' : 1,
                                'maskId' : protocol.maskVolume.getObjId(),
                                }) 
            
            context = base_wiz(request, context)
            return render_to_response('wizards/wiz_resmap.html', context)
Пример #14
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params["input"].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            volumes = self._getVols(objs)

            if len(volumes) == 0:
                return HttpResponse("errorIterate")

            context = {"objects": volumes, "params": params}

            context = base_wiz(request, context)

            return render_to_response("wizards/wiz_gaussian_vol.html", context)
Пример #15
0
    def _run(self, protocol, request):
        
        if not protocol.inputVolume.get().hasValue():
            return HttpResponse("errorInput")
        elif protocol.useSplitVolume == True:
            if not protocol.splitVolume.get().hasValue():
                return HttpResponse("errorInput")
        else:
            plotUrl, min_ang = getPlotResMap(request, protocol)

            ang = protocol.prewhitenAng.get()
            if ang < min_ang:
                ang = min_ang
            
            context = {
                       # Params
                       'inputId': protocol.inputVolume.get().getObjId(),
                       'ang': round(ang, 2),
                       'ramp': protocol.prewhitenRamp.get(),
                       # Extra Params
                       'pValue': protocol.pVal.get(),
                       'minRes': protocol.minRes.get(), 
                       'maxRes': protocol.maxRes.get(),
                       'stepRes': protocol.stepRes.get(),
                       # Others
                       'plot': plotUrl,
                       'min_ang': round(min_ang, 2),
                       'messi_js': getResourceJs('messi'),
                       'messi_css': getResourceCss('messi'),
                       }
            
            if protocol.useSplitVolume == True and protocol.splitVolume.get().hasValue():
                context.update({'useSplit' : 1,
                                'splitId' : protocol.splitVolume.getObjId(),
                                })
           
            if protocol.applyMask == True and protocol.maskVolume.get().hasValue():
                context.update({'useMask' : 1,
                                'maskId' : protocol.maskVolume.getObjId(),
                                }) 
            
            context = base_wiz(request, context)
            return render_to_response('wizards/wiz_resmap.html', context)
Пример #16
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            volumes = self._getVols(objs)

            if len(volumes) == 0:
                return HttpResponse("errorIterate")

            context = {'objects': volumes, 'params': params}

            context = base_wiz(request, context)

            return render_to_response('wizards/wiz_gaussian_vol.html', context)
Пример #17
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateParticles(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            particles = self._getParticles(objs)

            if len(particles) == 0:
                return HttpResponse("errorIterate")

            context = {'objects': particles,
                       'params':params}

            context = base_wiz(request, context)

            return render_to_response('wizards/wiz_gaussian_particle.html', context)
Пример #18
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        obj = params['input'].get()

        if obj is None:
            return HttpResponse("errorInput")
        else:
            # Single particle
            particle = obj.clone()
            particle.text = particle.getFileName()
            particle.basename = basename(particle.text)

            xdim = getImageXdim(request, particle.text)

            context = {'obj': particle, 'xdim': xdim, 'params': params}

            context = base_wiz(request, context)

            return render_to_response('wizards/wiz_custom_mask_spider.html',
                                      context)
Пример #19
0
 def _run(self, protocol, request):
     params = self._getParameters(protocol)
     obj = params['input'].get()
     
     if obj is None:
         return HttpResponse("errorInput")
     else:
         # Single particle
         particle = obj.clone()
         particle.text = particle.getFileName()
         particle.basename = basename(particle.text)
                 
         xdim = getImageXdim(request, particle.text)
 
         context = {'obj': particle,
                    'xdim':xdim,
                    'params': params }
     
         context = base_wiz(request, context)
         
         return render_to_response('wizards/wiz_custom_mask_spider.html', context)    
Пример #20
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params["input"].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            vols = self._getVols(objs)

            if len(vols) == 0:
                return HttpResponse("errorIterate")

            xdim = getImageXdim(request, vols[0].getFileName())

            params["value"] = validateMaskRadius(params["value"], xdim, radius=1)

            context = {"objects": vols, "xdim": int(xdim / 2), "params": params}

            context = base_wiz(request, context)
            return render_to_response("wizards/wiz_volume_mask_radius.html", context)
Пример #21
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            volumes = self._getVols(objs)

            if len(volumes) == 0:
                return HttpResponse("errorIterate")

            params['value'] = proccessModeFilter(params['mode'],
                                                 params['value'])
            params['label'] = ['', params['label'], '']

            params['samplingRate'] = objs.getSamplingRate()
            params['unit'] = UNIT_ANGSTROM

            # Correct default values to angstroms
            params['value'][0] = params['samplingRate'] / params['value'][0]
            params['value'][2] = params['samplingRate'] / params['value'][2]

            itemDim, _, _ = objs.getDim()

            params['min'] = 2. * params['samplingRate']
            params['max'] = 2. * itemDim * params['samplingRate']

            params['value'] = setValueOnRange(params['value'], params['min'],
                                              params['max'])

            context = {'objects': volumes, 'params': params}

            context = base_wiz(request, context)

            return render_to_response('wizards/wiz_filter_volumes.html',
                                      context)
Пример #22
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateSet(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            volumes = self._getVols(objs)

            if len(volumes) == 0:
                return HttpResponse("errorIterate")

            params['value'] = proccessModeFilter(params['mode'], params['value'])
            params['label'] = ['',params['label'],'']

            params['samplingRate'] = objs.getSamplingRate()
            params['unit'] = UNIT_ANGSTROM

            # Correct default values to angstroms
            params['value'][0] = params['samplingRate'] / params['value'][0]
            params['value'][2] = params['samplingRate'] / params['value'][2]

            itemDim,_,_ = objs.getDim()

            params['min'] = 2.*params['samplingRate']
            params['max'] = 2.*itemDim*params['samplingRate']

            params['value'] = setValueOnRange(params['value'], params['min'], params['max'])

            context = {'objects': volumes,
                       'params':params}

            context = base_wiz(request, context)

            return render_to_response('wizards/wiz_filter_volumes.html', context)
Пример #23
0
    def _run(self, protocol, request):
        params = self._getParameters(protocol)
        objs = params['input'].get()

        res = validateParticles(objs)

        if res is not 1:
            return HttpResponse(res)
        else:
            particles = self._getParticles(objs)

            if len(particles) == 0:
                return HttpResponse("errorIterate")

            params['value'] = proccessModeFilter(params['mode'],
                                                 params['value'])

            params['samplingRate'] = particles[1].getSamplingRate()

            itemDim, _, _ = particles[1].getDim()

            if params['unit'] == UNIT_ANGSTROM:
                params['min'] = 2. * params['samplingRate']
                params['max'] = 2. * itemDim * params['samplingRate']
            else:
                params['min'] = 0.01
                params['max'] = 0.5

            params['value'] = setValueOnRange(params['value'], params['min'],
                                              params['max'])

            context = {'objects': particles, 'params': params}

            context = base_wiz(request, context)

            return render_to_response('wizards/wiz_filter_particles.html',
                                      context)
Пример #24
0
 def _run(self, protocol, request):
     params = self._getParameters(protocol)
     objs = params['input'].get()
     
     res = validateParticles(objs) 
     
     if res is not 1:
         return HttpResponse(res)
     else:
         particles = self._getParticles(objs)
         
         if len(particles) == 0:
             return HttpResponse("errorIterate")
         
         xdim = getImageXdim(request, particles[0].text)
         
         params['value'] = validateMaskRadius(params['value'], xdim, radius=1)
         
         context = {'objects': particles,
                    'xdim': int(xdim/2),
                    'params': params}
     
         context = base_wiz(request, context)
         return render_to_response('wizards/wiz_particle_mask_radius.html', context)