text:
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package dns

import (
	"bufio"
	"context"
	"encoding/binary"
	"errors"
	"io"
	"net"
	"net/netip"
	"runtime"
	"sync/atomic"
	"time"

	"golang.org/x/exp/slices"
	"tailscale.com/health"
	"tailscale.com/net/dns/resolver"
	"tailscale.com/net/packet"
	"tailscale.com/net/tsaddr"
	"tailscale.com/net/tsdial"
	"tailscale.com/net/tstun"
	"tailscale.com/types/dnstype"
	"tailscale.com/types/ipproto"
	"tailscale.com/types/logger"
	"tailscale.com/util/clientmetric"
	"tailscale.com/util/dnsname"
	"tailscale.com/wgengine/monitor"
)

var (
	magicDNSIP   = tsaddr.TailscaleServiceIP()
	magicDNSIPv6 = tsaddr.TailscaleServiceIPv6()
)

var (
	errFullQueue = errors.New("request queue full")
)

// maxActiveQueries returns the maximal number of DNS requests that be
// can running.
// If EnqueueRequest is called when this many requests are already pending,
// the request will be dropped to avoid blocking the caller.
func maxActiveQueries() int32 {
	if runtime.GOOS == "ios" {
		// For memory paranoia reasons on iOS, match the
		// historical Tailscale 1.x..1.8 behavior for now
		// (just before the 1.10 release).
		return 64
	}
	// But for other platforms, allow more burstiness:
	return 256
}

// We use file-ignore below instead of ignore because on some platforms,
// the lint exception is necessary and on others it is not,
// and plain ignore complains if the exception is unnecessary.

// reconfigTimeout is the time interval within which Manager.{Up,Down} should complete.
//
// This is particularly useful because certain conditions can cause indefinite hangs
// (such as improper dbus auth followed by contextless dbus.Object.Call).
// Such operations should be wrapped in a timeout context.
const reconfigTimeout = time.Second

type response struct {
	pkt []byte
	to  netip.AddrPort // response destination (request source)
}

// Manager manages system DNS settings.
type Manager struct {
	logf logger.Logf

	// When netstack is not used, Manager implements magic DNS.
	// In this case, responses tracks completed DNS requests
	// which need a response, and NextPacket() synthesizes a
	// fake IP+UDP header to finish assembling the response.
	//
	// TODO(tom): Rip out once all platforms use netstack.
	responses           chan response
	activeQueriesAtomic int32

	ctx       context.Context    // good until Down
	ctxCancel context.CancelFunc // closes ctx

	resolver *resolver.Resolver
	os       OSConfigurator
}

// NewManagers created a new manager from the given config.
func NewManager(logf logger.Logf, oscfg OSConfigurator, linkMon *monitor.Mon, dialer *tsdial.Dialer, linkSel resolver.ForwardLinkSelector) *Manager {
	if dialer == nil {
		panic("nil Dialer")
	}
	logf = logger.WithPrefix(logf, "dns: ")
	m := &Manager{
		logf:      logf,
		resolver:  resolver.New(logf, linkMon, linkSel, dialer),
		os:        oscfg,
		responses: make(chan response),
	}
	m.ctx, m.ctxCancel = context.WithCancel(context.Background())
	m.logf("using %T", m.os)
	return m
}

// Resolver returns the Manager's DNS Resolver.
func (m *Manager) Resolver() *resolver.Resolver { return m.resolver }

func (m *Manager) Set(cfg Config) error {
	m.logf("Set: %v", logger.ArgWriter(func(w *bufio.Writer) {
		cfg.WriteToBufioWriter(w)
	}))

	rcfg, ocfg, err := m.compileConfig(cfg)
	if err != nil {
		return err
	}

	m.logf("Resolvercfg: %v", logger.ArgWriter(func(w *bufio.Writer) {
		rcfg.WriteToBufioWriter(w)
	}))
	m.logf("OScfg: %+v", ocfg)

	if err := m.resolver.SetConfig(rcfg); err != nil {
		return err
	}
	if err := m.os.SetDNS(ocfg); err != nil {
		health.SetDNSOSHealth(err)
		return err
	}
	health.SetDNSOSHealth(nil)

	return nil
}

// compileHostEntries creates a list of single-label resolutions possible
// from the configured hosts and search domains.
// The entries are compiled in the order of the search domains, then the hosts.
// The returned list is sorted by the first hostname in each entry.
func compileHostEntries(cfg Config) (hosts []*HostEntry) {
	didLabel := make(map[string]bool, len(cfg.Hosts))
	for _, sd := range cfg.SearchDomains {
		for h, ips := range cfg.Hosts {
			if !sd.Contains(h) || h.NumLabels() != (sd.NumLabels()+1) {
				continue
			}
			ipHosts := []string{string(h.WithTrailingDot())}
			if label := dnsname.FirstLabel(string(h)); !didLabel[label] {
				didLabel[label] = true
				ipHosts = append(ipHosts, label)
			}
			for _, ip := range ips {
				if cfg.OnlyIPv6 && ip.Is4() {
					continue
				}
				hosts = append(hosts, &HostEntry{
					Addr:  ip,
					Hosts: ipHosts,
				})
				// Only add IPv4 or IPv6 per host, like we do in the resolver.
				break
			}
		}
	}
	slices.SortFunc(hosts, func(a, b *HostEntry) bool {
		if len(a.Hosts) == 0 {
			return false
		}
		if len(b.Hosts) == 0 {
			return true
		}
		return a.Hosts[0] < b.Hosts[0]
	})
	return hosts
}

// compileConfig converts cfg into a quad-100 resolver configuration
// and an OS-level configuration.
func (m *Manager) compileConfig(cfg Config) (rcfg resolver.Config, ocfg OSConfig, err error) {
	// The internal resolver always gets MagicDNS hosts and
	// authoritative suffixes, even if we don't propagate MagicDNS to
	// the OS.
	rcfg.Hosts = cfg.Hosts
	routes := map[dnsname.FQDN][]*dnstype.Resolver{} // assigned conditionally to rcfg.Routes below.
	for suffix, resolvers := range cfg.Routes {
		if len(resolvers) == 0 {
			rcfg.LocalDomains = append(rcfg.LocalDomains, suffix)
		} else {
			routes[suffix] = resolvers
		}
	}

	// Similarly, the OS always gets search paths.
	ocfg.SearchDomains = cfg.SearchDomains
	if runtime.GOOS == "windows" {
		ocfg.Hosts = compileHostEntries(cfg)
	}

	// Deal with trivial configs first.
	switch {
	case !cfg.needsOSResolver():
		// Set search domains, but nothing else. This also covers the
		// case where cfg is entirely zero, in which case these
		// configs clear all Tailscale DNS settings.
		return rcfg, ocfg, nil
	case cfg.hasDefaultIPResolversOnly() && !cfg.hasHostsWithoutSplitDNSRoutes():
		// Trivial CorpDNS configuration, just override the OS resolver.
		//
		// If there are hosts (ExtraRecords) that are not covered by an existing
		// SplitDNS route, then we don't go into this path so that we fall into
		// the next case and send the extra record hosts queries through
		// 100.100.100.100 instead where we can answer them.
		//
		// TODO: for OSes that support it, pass IP:port and DoH
		// addresses directly to OS.
		// https://github.com/tailscale/tailscale/issues/1666
		ocfg.Nameservers = toIPsOnly(cfg.DefaultResolvers)
		return rcfg, ocfg, nil
	case cfg.hasDefaultResolvers():
		// Default resolvers plus other stuff always ends up proxying
		// through quad-100.
		rcfg.Routes = routes
		rcfg.Routes["."] = cfg.DefaultResolvers
		ocfg.Nameservers = []netip.Addr{cfg.serviceIP()}
		return rcfg, ocfg, nil
	}

	// From this point on, we're figuring out split DNS
	// configurations. The possible cases don't return directly any
	// more, because as a final step we have to handle the case where
	// the OS can't do split DNS.

	// Workaround for
	// https://github.com/tailscale/corp/issues/1662. Even though
	// Windows natively supports split DNS, it only configures linux
	// containers using whatever the primary is, and doesn't apply
	// NRPT rules to DNS traffic coming from WSL.
	//
	// In order to make WSL work okay when the host Windows is using
	// Tailscale, we need to set up quad-100 as a "full proxy"
	// resolver, regardless of whether Windows itself can do split
	// DNS. We still make Windows do split DNS itself when it can, but
	// quad-100 will still have the full split configuration as well,
	// and so can service WSL requests correctly.
	//
	// This bool is used in a couple of places below to implement this
	// workaround.
	isWindows := runtime.GOOS == "windows"
	if cfg.singleResolverSet() != nil && m.os.SupportsSplitDNS() && !isWindows {
		// Split DNS configuration requested, where all split domains
		// go to the same resolvers. We can let the OS do it.
		ocfg.Nameservers = toIPsOnly(cfg.singleResolverSet())
		ocfg.MatchDomains = cfg.matchDomains()
		return rcfg, ocfg, nil
	}

	// Split DNS configuration with either multiple upstream routes,
	// or routes + MagicDNS, or just MagicDNS, or on an OS that cannot
	// split-DNS. Install a split config pointing at quad-100.
	rcfg.Routes = routes
	ocfg.Nameservers = []netip.Addr{cfg.serviceIP()}

	if m.os.SupportsSplitDNS() {
		ocfg.MatchDomains = cfg.matchDomains()
	} else {
		// If the OS can't do native split-dns, read out the underlying
		// resolver config and blend it into our config.
		bcfg, err := m.os.GetBaseConfig()
		if err != nil {
			health.SetDNSOSHealth(err)
			return resolver.Config{}, OSConfig{}, err
		}
		var defaultRoutes []*dnstype.Resolver
		for _, ip := range bcfg.Nameservers {
			defaultRoutes = append(defaultRoutes, &dnstype.Resolver{Addr: ip.String()})
		}
		rcfg.Routes["."] = defaultRoutes
		ocfg.SearchDomains = append(ocfg.SearchDomains, bcfg.SearchDomains...)
	}

	return rcfg, ocfg, nil
}

// toIPsOnly returns only the IP portion of dnstype.Resolver.
// Only safe to use if the resolvers slice has been cleared of
// DoH or custom-port entries with something like hasDefaultIPResolversOnly.
func toIPsOnly(resolvers []*dnstype.Resolver) (ret []netip.Addr) {
	for _, r := range resolvers {
		if ipp, ok := r.IPPort(); ok && ipp.Port() == 53 {
			ret = append(ret, ipp.Addr())
		}
	}
	return ret
}

// EnqueuePacket is the legacy path for handling magic DNS traffic, and is
// called with a DNS request payload.
//
// TODO(tom): Rip out once all platforms use netstack.
func (m *Manager) EnqueuePacket(bs []byte, proto ipproto.Proto, from, to netip.AddrPort) error {
	if to.Port() != 53 || proto != ipproto.UDP {
		return nil
	}

	if n := atomic.AddInt32(&m.activeQueriesAtomic, 1); n > maxActiveQueries() {
		atomic.AddInt32(&m.activeQueriesAtomic, -1)
		metricDNSQueryErrorQueue.Add(1)
		return errFullQueue
	}

	go func() {
		resp, err := m.resolver.Query(m.ctx, bs, from)
		if err != nil {
			atomic.AddInt32(&m.activeQueriesAtomic, -1)
			m.logf("dns query: %v", err)
			return
		}

		select {
		case <-m.ctx.Done():
			return
		case m.responses <- response{resp, from}:
		}
	}()
	return nil
}

// NextPacket is the legacy path for obtaining DNS results in response to
// magic DNS queries. It blocks until a response is available.
//
// TODO(tom): Rip out once all platforms use netstack.
func (m *Manager) NextPacket() ([]byte, error) {
	var resp response
	select {
	case <-m.ctx.Done():
		return nil, net.ErrClosed
	case resp = <-m.responses:
		// continue
	}

	// Unused space is needed further down the stack. To avoid extra
	// allocations/copying later on, we allocate such space here.
	const offset = tstun.PacketStartOffset

	var buf []byte
	switch {
	case resp.to.Addr().Is4():
		h := packet.UDP4Header{
			IP4Header: packet.IP4Header{
				Src: magicDNSIP,
				Dst: resp.to.Addr(),
			},
			SrcPort: 53,
			DstPort: resp.to.Port(),
		}
		hlen := h.Len()
		buf = make([]byte, offset+hlen+len(resp.pkt))
		copy(buf[offset+hlen:], resp.pkt)
		h.Marshal(buf[offset:])
	case resp.to.Addr().Is6():
		h := packet.UDP6Header{
			IP6Header: packet.IP6Header{
				Src: magicDNSIPv6,
				Dst: resp.to.Addr(),
			},
			SrcPort: 53,
			DstPort: resp.to.Port(),
		}
		hlen := h.Len()
		buf = make([]byte, offset+hlen+len(resp.pkt))
		copy(buf[offset+hlen:], resp.pkt)
		h.Marshal(buf[offset:])
	}

	atomic.AddInt32(&m.activeQueriesAtomic, -1)
	return buf, nil
}

// Query executes a DNS query recieved from the given address. The query is
// provided in bs as a wire-encoded DNS query without any transport header.
// This method is called for requests arriving over UDP and TCP.
func (m *Manager) Query(ctx context.Context, bs []byte, from netip.AddrPort) ([]byte, error) {
	select {
	case <-m.ctx.Done():
		return nil, net.ErrClosed
	default:
		// continue
	}

	if n := atomic.AddInt32(&m.activeQueriesAtomic, 1); n > maxActiveQueries() {
		atomic.AddInt32(&m.activeQueriesAtomic, -1)
		metricDNSQueryErrorQueue.Add(1)
		return nil, errFullQueue
	}
	defer atomic.AddInt32(&m.activeQueriesAtomic, -1)
	return m.resolver.Query(ctx, bs, from)
}

const (
	// RFC 7766 6.2 recommends connection reuse & request pipelining
	// be undertaken, and the connection be closed by the server
	// using an idle timeout on the order of seconds.
	idleTimeoutTCP = 45 * time.Second
	// The RFCs don't specify the max size of a TCP-based DNS query,
	// but we want to keep this reasonable. Given payloads are typically
	// much larger and all known client send a single query, I've arbitrarily
	// chosen 2k.
	maxReqSizeTCP = 2048
)

// dnsTCPSession services DNS requests sent over TCP.
type dnsTCPSession struct {
	m *Manager

	conn    net.Conn
	srcAddr netip.AddrPort

	readClosing chan struct{}
	responses   chan []byte // DNS replies pending writing

	ctx      context.Context
	closeCtx context.CancelFunc
}

func (s *dnsTCPSession) handleWrites() {
	defer s.conn.Close()
	defer close(s.responses)
	defer s.closeCtx()

	for {
		select {
		case <-s.readClosing:
			return // connection closed or timeout, teardown time

		case resp := <-s.responses:
			s.conn.SetWriteDeadline(time.Now().Add(idleTimeoutTCP))
			if err := binary.Write(s.conn, binary.BigEndian, uint16(len(resp))); err != nil {
				s.m.logf("tcp write (len): %v", err)
				return
			}
			if _, err := s.conn.Write(resp); err != nil {
				s.m.logf("tcp write (response): %v", err)
				return
			}
		}
	}
}

func (s *dnsTCPSession) handleQuery(q []byte) {
	resp, err := s.m.Query(s.ctx, q, s.srcAddr)
	if err != nil {
		s.m.logf("tcp query: %v", err)
		return
	}

	select {
	case <-s.ctx.Done():
	case s.responses <- resp:
	}
}

func (s *dnsTCPSession) handleReads() {
	defer close(s.readClosing)

	for {
		select {
		case <-s.ctx.Done():
			return

		default:
			s.conn.SetReadDeadline(time.Now().Add(idleTimeoutTCP))
			var reqLen uint16
			if err := binary.Read(s.conn, binary.BigEndian, &reqLen); err != nil {
				if err == io.EOF || err == io.ErrClosedPipe {
					return // connection closed nominally, we gucci
				}
				s.m.logf("tcp read (len): %v", err)
				return
			}
			if int(reqLen) > maxReqSizeTCP {
				s.m.logf("tcp request too large (%d > %d)", reqLen, maxReqSizeTCP)
				return
			}

			buf := make([]byte, int(reqLen))
			if _, err := io.ReadFull(s.conn, buf); err != nil {
				s.m.logf("tcp read (payload): %v", err)
				return
			}

			select {
			case <-s.ctx.Done():
				return
			default:
				go s.handleQuery(buf)
			}
		}
	}
}

// HandleTCPConn implements magicDNS over TCP, taking a connection and
// servicing DNS requests sent down it.
func (m *Manager) HandleTCPConn(conn net.Conn, srcAddr netip.AddrPort) {
	s := dnsTCPSession{
		m:           m,
		conn:        conn,
		srcAddr:     srcAddr,
		responses:   make(chan []byte),
		readClosing: make(chan struct{}),
	}
	s.ctx, s.closeCtx = context.WithCancel(m.ctx)
	go s.handleReads()
	s.handleWrites()
}

func (m *Manager) Down() error {
	m.ctxCancel()
	if err := m.os.Close(); err != nil {
		return err
	}
	m.resolver.Close()
	return nil
}

func (m *Manager) FlushCaches() error {
	return flushCaches()
}

// Cleanup restores the system DNS configuration to its original state
// in case the Tailscale daemon terminated without closing the router.
// No other state needs to be instantiated before this runs.
func Cleanup(logf logger.Logf, interfaceName string) {
	oscfg, err := NewOSConfigurator(logf, interfaceName)
	if err != nil {
		logf("creating dns cleanup: %v", err)
		return
	}
	dns := NewManager(logf, oscfg, nil, new(tsdial.Dialer), nil)
	if err := dns.Down(); err != nil {
		logf("dns down: %v", err)
	}
}

var (
	metricDNSQueryErrorQueue = clientmetric.NewCounter("dns_query_local_error_queue")
)

repository: bdd/tailscale

repo_name: bdd/tailscale

gha_language: Go

extension: go


text:
package publishers

import (
	"fmt"
	"log"
	"time"

	"github.com/xeviknal/background-commons/database"
	"github.com/xeviknal/background-commons/models"
	"github.com/xeviknal/background-processing/buffer"
)

type JobCancellerPublisher struct{}
type JobCancellerConsumer struct{}

// Checking that JobCancellerPublisher implements
//  Publisher interface at compile time
var _ Publisher = (*JobCancellerPublisher)(nil)

var defaultTimeout = 10

func (jc JobCancellerPublisher) Publish() {
	db := database.GetDb()

	// Starting a Db transaction
	trans, err := db.Begin()
	if err != nil {
		log.Fatalf("error when starting a transaction for %T: %v", jc, err)
	}

	// Fetching the jobs that exceeded maximum execution time allowed
	var jobs []models.Job
	_, err = trans.Select(&jobs, fmt.Sprintf("SELECT * FROM jobs WHERE started_at IS NOT NULL "+
		"AND TIMEDIFF(NOW(), started_at) > SEC_TO_TIME(%d) AND cancelled_at IS NULL AND finished_at IS NULL FOR UPDATE", defaultTimeout))
	if err != nil {
		log.Fatalf("error querying for %T: %v", jc, err)
	}

	queue := buffer.GetBuffer()
	for _, job := range jobs {
		descriptor := buffer.Descriptor(buffer.TaskDescriptor{
			Consumer:   "JobCancellerConsumer",
			Descriptor: map[string]interface{}{"id": job.Id},
		})
		queue.Add(&descriptor)

		// Bookkeeping: job cancellation time
		now := time.Now()
		job.CancelledAt = &now
		trans.Update(&job)
	}
	trans.Commit()
}

repository: xeviknal/background-processing

license_type: permissive

repo_name: xeviknal/background-processing

branch_name: refs/heads/main


text:
@inproceedings{geremia2010,
  title={Spatial decision forests for {MS} lesion segmentation in multi-channel {MR} images},
  author={Geremia, Ezequiel and Menze, Bjoern H and Clatz, Olivier and Konukoglu, Ender and Criminisi, Antonio and Ayache, Nicholas},
  booktitle={Jian, T., Navab, N., Pluim, J., Viergever, M. (eds.) MICCAI 2010, Part I. LNCS, vol. 6362},
  pages={111--118},
  year={2010},
  publisher={Springer, Heidelberg}
}

@incollection{weiss2013,
  title={Multiple sclerosis lesion segmentation using dictionary learning and sparse coding},
  author={Weiss, Nick and Rueckert, Daniel and Rao, Anil},
  booktitle={Mori, K., Sakuma, I., Sato, Y., Barillot, C., Navab, N. (eds.) MICCAI 2013, Part I. LNCS 8149},
  pages={735--742},
  year={2013},
  publisher={Springer, Heidelberg}
}

@incollection{yoo2014,
  title={Deep Learning of Image Features from Unlabeled Data for Multiple Sclerosis Lesion Segmentation},
  author={Yoo, Youngjin and Brosch, Tom and Traboulsee, Anthony and Li, David KB and Tam, Roger},
  booktitle={Wu, G., Zhang D., Zhou L. (eds.) MLMI 2014, LNCS, vol. 8679},
  pages={117--124},
  year={2014},
  publisher={Springer, Heidelberg}
}

@inproceedings{souplet2008,
  title={An automatic segmentation of {T2-FLAIR} multiple sclerosis lesions},
  author={Souplet, Jean-Christophe and Lebrun, Christine and Ayache, Nicholas and Malandain, Gr{\'e}goire},
  booktitle={MIDAS Journal - MICCAI 2008 Workshop},
  year={2008}
}

@article {Ciresan2012,
author={Ciresan, D and Giusti, Alessandro and Schmidhuber, J},
title={Deep neural networks segment neuronal membranes in electron microscopy images},
journal={Advances in Neural Information Processing Systems},
year={2012},
pages={1--9},
}

@article{LeCun1998,
  title={Gradient-based learning applied to document recognition},
  author={LeCun, Yann and Bottou, L{\'e}on and Bengio, Yoshua and Haffner, Patrick},
  journal={Proceedings of the {IEEE}},
  volume={86},
  number={11},
  pages={2278--2324},
  year={1998},
  publisher={IEEE}
}

@inproceedings{zeiler2011,
  title={Adaptive deconvolutional networks for mid and high level feature learning},
  author={Zeiler, Matthew D and Taylor, Graham W and Fergus, Rob},
  booktitle={2011 IEEE International Conference on Computer Vision (ICCV)},
  pages={2018--2025},
  year={2011},
  organization={IEEE}
}

@incollection{masci2011,
  title={Stacked convolutional auto-encoders for hierarchical feature extraction},
  author={Masci, Jonathan and Meier, Ueli and Cire{\c{s}}an, Dan and Schmidhuber, J{\"u}rgen},
  booktitle={Artificial Neural Networks and Machine Learning--ICANN 2011},
  pages={52--59},
  year={2011},
  publisher={Springer}
}

@article{styner20083d,
  title={{3D} segmentation in the clinic: A grand challenge {II}: {MS} lesion segmentation},
  author={Styner, Martin and Lee, Joohwi and Chin, Brian and Chin, M and Commowick, Olivier and Tran, H and Markovic-Plese, S and Jewells, V and Warfield, S},
  journal={MIDAS Journal - MICCAI 2008 Workshop},
  pages={1--6},
  year={2008},
  publisher={Citeseer}
}

@article{kang2014fully,
  title={Fully Convolutional Neural Networks for Crowd Segmentation},
  author={Kang, Kai and Wang, Xiaogang},
  journal={arXiv preprint arXiv:1411.4464},
  year={2014}
}

@article{duchi2011adaptive,
  title={Adaptive subgradient methods for online learning and stochastic optimization},
  author={Duchi, John and Hazan, Elad and Singer, Yoram},
  journal={The Journal of Machine Learning Research},
  volume={12},
  pages={2121--2159},
  year={2011},
  publisher={JMLR.org}
}

@article{kingma2014adam,
  title={Adam: A method for stochastic optimization},
  author={Kingma, Diederik and Ba, Jimmy},
  journal={arXiv preprint arXiv:1412.6980},
  year={2014}
}

@article{zeiler2012adadelta,
  title={ADADELTA: An adaptive learning rate method},
  author={Zeiler, Matthew D},
  journal={arXiv preprint arXiv:1212.5701},
  year={2012}
}

@article{dauphin2015rmsprop,
  title={RMSProp and equilibrated adaptive learning rates for non-convex optimization},
  author={Dauphin, Yann N and de Vries, Harm and Chung, Junyoung and Bengio, Yoshua},
  journal={arXiv preprint arXiv:1502.04390},
  year={2015}
}

@inproceedings{martens2010deep,
  title={Deep learning via Hessian-free optimization},
  author={Martens, James},
  booktitle={Proceedings of the 27th International Conference on Machine Learning (ICML-10)},
  pages={735--742},
  year={2010}
}

@inproceedings{brosch2015,
  title={Deep convolutional encoder networks for multiple sclerosis lesion segmentation},
  author={Brosch, Tom and Yoo, Youngjin and Tang, Lisa Y.W. and Li, David K.B. and Traboulsee, Anthony and Tam, Roger},
  booktitle={A. Frangi et al. (Eds.): MICCAI 2015, Part III, LNCS, vol. 9351},
  pages={3--11},
  year={2015},
  publisher={Springer}
}

@InProceedings{ronneberger2015,
  author = 	 {Ronneberger, Olaf and Fischer, Philipp and Brox, Thomas},
  title = 	 {U-Net: Convolutional Networks for Biomedical Image Segmentation},
  booktitle = {Proceedings of the 18th International Conferene on Medical Image Computing and Computer Assisted Interventions (MICCAI 2015)},
  pages = 	 {8},
  year = 	 {2015}
}

@inproceedings{jenkinson2005bet2,
  title={{BET2}: {MR}-based estimation of brain, skull and scalp surfaces},
  author={Jenkinson, Mark and Pechaud, Mickael and Smith, Stephen},
  booktitle={Eleventh annual meeting of the organization for human brain mapping},
  volume={17},
  year={2005},
  organization={Toronto, ON}
}

@article {Hinton2006b,
author={Hinton, Geoffrey E. and Osindero, Simon and Teh, Yee-Whye},
title={A fast learning algorithm for deep belief nets},
volume={18},
number={7},
journal={Neural Computation},
publisher={MIT Press},
year={2006},
pages={1527--1554},
}

@article {Hinton2006,
author={Hinton, Geoffrey E. and Salakhutdinov, Ruslan},
title={Reducing the dimensionality of data with neural networks},
volume={313},
number={5786},
journal={Science},
year={2006},
month={Jul},
pages={504--507},
}

@article{hochreiter1991untersuchungen,
  title={Untersuchungen zu dynamischen neuronalen {Netzen}},
  author={Hochreiter, Sepp},
  journal={Diploma, Technische Universit{\"a}t M{\"u}nchen},
  year={1991}
}

@article{shiee2010topology,
  title={A topology-preserving approach to the segmentation of brain images with multiple sclerosis lesions},
  author={Shiee, Navid and Bazin, Pierre-Louis and Ozturk, Arzu and Reich, Daniel S and Calabresi, Peter A and Pham, Dzung L},
  journal={NeuroImage},
  volume={49},
  number={2},
  pages={1524--1535},
  year={2010},
  publisher={Elsevier}
}

@article{dice1945measures,
  title={Measures of the amount of ecologic association between species},
  author={Dice, Lee R},
  journal={Ecology},
  volume={26},
  number={3},
  pages={297--302},
  year={1945},
  publisher={JSTOR}
}

@article{garcia2013review,
  title={Review of automatic segmentation methods of multiple sclerosis white matter lesions on conventional magnetic resonance imaging},
  author={Garc{\'\i}a-Lorenzo, Daniel and Francis, Simon and Narayanan, Sridar and Arnold, Douglas L and Collins, D Louis},
  journal={Medical image analysis},
  volume={17},
  number={1},
  pages={1--18},
  year={2013},
  publisher={Elsevier}
}

@incollection{scherer2010evaluation,
  title={Evaluation of pooling operations in convolutional architectures for object recognition},
  author={Scherer, Dominik and M{\"u}ller, Andreas and Behnke, Sven},
  booktitle={Artificial Neural Networks--ICANN 2010},
  pages={92--101},
  year={2010},
  publisher={Springer}
}

@inproceedings{lee2009convolutional,
  title={Convolutional deep belief networks for scalable unsupervised learning of hierarchical representations},
  author={Lee, Honglak and Grosse, Roger and Ranganath, Rajesh and Ng, Andrew Y},
  booktitle={Proceedings of the 26th Annual International Conference on Machine Learning},
  pages={609--616},
  year={2009},
  organization={ACM}
}

@article{brosch2014efficient,
  title={Efficient training of convolutional deep belief networks in the frequency domain for application to high-resolution {2D} and {3D} images},
  author={Brosch, Tom and Tam, Roger},
  journal={Neural computation},
  year={2014},
  publisher={MIT Press}
}

@inproceedings{sutskever2013importance,
  title={On the importance of initialization and momentum in deep learning},
  author={Sutskever, Ilya and Martens, James and Dahl, George and Hinton, Geoffrey},
  booktitle={Proceedings of the 30th international conference on machine learning (ICML-13)},
  pages={1139--1147},
  year={2013}
}

@article{kappos2006long,
  title={Long-term subcutaneous interferon beta-1a therapy in patients with relapsing-remitting {MS}},
  author={Kappos, L and Traboulsee, A and Constantinescu, C and Er{\"a}linna, J-P and Forrestal, F and Jongen, P and Pollard, J and Sandberg-Wollheim, Magnhild and Sindic, C and Stubinski, B and others},
  journal={Neurology},
  volume={67},
  number={6},
  pages={944--953},
  year={2006},
  publisher={AAN Enterprises}
}

@article{traboulsee2008reduction,
  title={Reduction in magnetic resonance imaging {T2} burden of disease in patients with relapsing-remitting multiple sclerosis: analysis of 48-week data from the {EVIDENCE (EVidence of Interferon Dose-response: European North American Comparative Efficacy)} study},
  author={Traboulsee, A and Al-Sabbagh, A and Bennett, R and Chang, P and Li, DKB and others},
  journal={BMC Neurology},
  volume={8},
  number={1},
  pages={11},
  year={2008},
  publisher={BioMed Central Ltd}
}

@article{schmidt2012automated,
  title={An automated tool for detection of {FLAIR}-hyperintense white-matter lesions in multiple sclerosis},
  author={Schmidt, Paul and Gaser, Christian and Arsic, Milan and Buck, Dorothea and F{\"o}rschler, Annette and Berthele, Achim and Hoshi, Muna and Ilg, R{\"u}diger and Schmid, Volker J and Zimmer, Claus and others},
  journal={NeuroImage},
  volume={59},
  number={4},
  pages={3774--3783},
  year={2012},
  publisher={Elsevier}
}

@article{sudre2015,
  title={Bayesian model selection for pathological neuroimaging data applied to white matter lesion segmentation},
  author={Sudre, Carole and Cardoso, M Jorge and Bouvy, Willem and Biessels, Geert and Barnes, Josephine and Ourselin, Sebastien},
  year={2015},
  journal={IEEE Transactions on Medical Imaging},
  volume={34},
  number={10},
  pages={2079--2102},
  publisher={IEEE}
}

@article{vanleemput2001,
  title={Automated segmentation of multiple sclerosis lesions by model outlier detection},
  author={Van Leemput, Koen and Maes, Frederik and Vandermeulen, Dirk and Colchester, Alan and Suetens, Paul},
  journal={IEEE Transactions on Medical Imaging},
  volume={20},
  number={8},
  pages={677--688},
  year={2001},
  publisher={IEEE}
}

@article{tomas2015,
  title={A model of population and subject {(MOPS)} intensities with application to multiple sclerosis lesion segmentation},
  author={Tomas-Fernandez, Xavier and Warfield, Simon Keith},
  year={2015},
  journal={IEEE Transactions on Medical Imaging},
  volume={34},
  number={6},
  pages={1349--1361},
  publisher={IEEE}
}

@inproceedings{subbanna2015,
  title={{IMaGe}: {Iterative} Multilevel Probabilistic Graphical Model for Detection and Segmentation of Multiple Sclerosis Lesions in Brain {MRI}},
  author={Subbanna, Nagesh and Precup, Doina and Arnold, Douglas and Arbel, Tal},
  booktitle={Information Processing in Medical Imaging},
  pages={514--526},
  year={2015},
  organization={Springer}
}

@article{guizard2015,
  title={Rotation-invariant multi-contrast non-local means for {MS} lesion segmentation},
  author={Guizard, Nicolas and Coup{\'e}, Pierrick and Fonov, Vladimir S and Manj{\'o}n, Jose V and Arnold, Douglas L and Collins, D Louis},
  journal={NeuroImage: Clinical},
  volume={8},
  pages={376--389},
  year={2015},
  publisher={Elsevier}
}

@article{coupe2011,
  title={Patch-based segmentation using expert priors: Application to hippocampus and ventricle segmentation},
  author={Coup{\'e}, Pierrick and Manj{\'o}n, Jos{\'e} V and Fonov, Vladimir and Pruessner, Jens and Robles, Montserrat and Collins, D Louis},
  journal={NeuroImage},
  volume={54},
  number={2},
  pages={940--954},
  year={2011},
  publisher={Elsevier}
}

@inproceedings{long2015,
  title={Fully Convolutional Networks for Semantic Segmentation},
  author={Long, Jonathan and Shelhamer, Evan and Darrell, Trevor},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  pages={3431--3440},
  year={2015}
}

@article{roura2015,
  title={A toolbox for multiple sclerosis lesion segmentation},
  author={Roura, Eloy and Oliver, Arnau and Cabezas, Mariano and Valverde, Sergi and Pareto, Deborah and Vilanova, Joan C and Rami{\'o}-Torrent{\`a}, Llu{\'\i}s and Rovira, {\`A}lex and Llad{\'o}, Xavier},
  journal={Neuroradiology},
  volume={57},
  number={10},
  pages={1031--1043},
  year={2015},
  publisher={Springer}
}

@inproceedings{subbanna2009,
  title={MS lesion segmentation using Markov Random Fields},
  author={Subbanna, NK and Shah, M and Francis, SJ and Narayanan, S and Collins, DL and Arnold, DL and Arbel, T},
  booktitle={Proceedings the MICCAI 2009 Workshop on Medical Image Analysis on Multiple Sclerosis},
  pages={1--12},
  year={2009}
}

@article{breiman2001,
  title={Random forests},
  author={Breiman, Leo},
  journal={Machine learning},
  volume={45},
  number={1},
  pages={5--32},
  year={2001},
  publisher={Springer}
}

@InProceedings{nair2010,
  author    = {Nair, Vinod and Hinton, Geoffrey E.},
  title     = {Rectified linear units improve restricted {Boltzmann} machines},
  booktitle = {Proceedings of the 27th Annual International Conference on Machine Learning},
  year      = {2010},
  pages     = {807--814}
}

@InProceedings{krizhevsky2012,
  author    = {Krizhevsky, Alex and Sutskever, I and Hinton, G},
  title     = {{ImageNet} classification with deep convolutional neural networks},
  booktitle = {Advances in Neural Information Processing Systems},
  year      = {2012},
  pages     = {1--9}
}

@article{chetlur2014,
  title={{cuDNN}: {Efficient} primitives for deep learning},
  author={Chetlur, Sharan and Woolley, Cliff and Vandermersch, Philippe and Cohen, Jonathan and Tran, John and Catanzaro, Bryan and Shelhamer, Evan},
  journal={arXiv preprint arXiv:1410.0759},
  year={2014}
}

@article{jia2014,
  Author = {Jia, Yangqing and Shelhamer, Evan and Donahue, Jeff and Karayev, Sergey and Long, Jonathan and Girshick, Ross and Guadarrama, Sergio and Darrell, Trevor},
  Journal = {arXiv preprint arXiv:1408.5093},
  Title = {Caffe: Convolutional Architecture for Fast Feature Embedding},
  Year = {2014}
}

@MISC{Bastien2012,
        author = {Bastien, Fr{\'{e}}d{\'{e}}ric and Lamblin, Pascal and Pascanu, Razvan and Bergstra, James and Goodfellow, Ian J. and Bergeron, Arnaud and Bouchard, Nicolas and Bengio, Yoshua},
         title = {Theano: new features and speed improvements},
          year = {2012},
  howpublished = {Deep Learning and Unsupervised Feature Learning NIPS 2012 Workshop},
}

@inproceedings{collobert2011torch7,
  title={Torch7: A matlab-like environment for machine learning},
  author={Collobert, Ronan and Kavukcuoglu, Koray and Farabet, Cl{\'e}ment},
  booktitle={BigLearn, NIPS Workshop},
  number={EPFL-CONF-192376},
  year={2011}
}

@misc{jesson2015,
	author = {Andrew Jesson and Tal Arbel},
	title = {Hierarchical {MRF} and Random Forest Segmentation of {MS} Lesions and Healthy Tissues in Brain {MRI}},
	year = {2015}
}

@misc{maier2015,
 author = {Oskar Maier and Heinz Handels},
 title = {{MS} Lesion Segmentation in {MRI} with Random Forests},
 year = {2015}
}

repository: e-thereal/tbplayground

repo_name: e-thereal/tbplayground

branch_name: refs/heads/master

extension: bib


text:
@Proceedings{COLT-2015,
  booktitle = {Proceedings of The 28th Conference on Learning Theory},
  editor = {Gr\"unwald, Peter and Hazan, Elad and Kale, Satyen},
  volume = {40},
  year = {2015},
  shortname = {COLT},
  sections = {preface=Preface|default=Regular Papers|open=Open Problems}
}

license: MIT

repository: mreid/papersite

repo_name: mreid/papersite

gha_license_id: MIT

gha_language: TeX


text:
require mpfr_${PV}.bb
inherit native
DEPENDS = "gmp-native"

SRC_URI[md5sum] = "527147c097874340cb9cee0579dacf3b"
SRC_URI[sha256sum] = "18e078c996e182b7ceab32f2ab840e6a151b593e0cd5b83cb9d2960f212fba4c"

extension: bb