text:
package emr_vis_nlp.controller;

import emr_vis_nlp.main.MainTabbedView;
import emr_vis_nlp.view.glasspane.MainViewGlassPane;
import emr_vis_nlp.view.doc_details_popup.DocFocusPopup;
import emr_vis_nlp.view.var_bar_chart.VarBarChartForCell;
import emr_vis_nlp.ml.PredictionCertaintyTuple;
import emr_vis_nlp.model.mpqa_colon.MpqaColonMainModel;
import emr_vis_nlp.ml.MLPredictor;
import emr_vis_nlp.view.glasspane.DocDetailsTableModel;
import emr_vis_nlp.view.doc_table.DocTableModel;
import emr_vis_nlp.view.doc_table.AttrTableModel;
import emr_vis_nlp.view.doc_grid.DocGridTableSelectorModel;
import emr_vis_nlp.model.*;
import emr_vis_nlp.view.doc_grid.DocumentGrid;
import emr_vis_nlp.view.doc_grid.DocumentGrid.DocGridDragControl;
import emr_vis_nlp.view.doc_grid.DocumentGrid.DocumentSelectControl;
import emr_vis_nlp.view.doc_grid.DocumentGridTable;
import java.io.File;
import java.util.*;
import javax.swing.JFrame;
import javax.swing.text.AbstractDocument;

/**
 *
 * Fulfills the Controller role of the MVC design pattern. Responsible for all
 * communication and coordination among the backing MainModel and the front-end
 * MainView. Is tasked with querying the back-end model and building many of the
 * intermediate data structures (ie, TableModels) required by front-end
 * components, and monitoring and updating these intermediate structures as
 * necessary.
 *
 * @author alexander.p.conrad@gmail.com
 */
public class MainController {

    /**
     * single controller instance (singleton design pattern)
     */
    private static MainController mainController = null;
    /**
     * main model controlled by this
     */
    private MainModel model = null;
    /**
     * main view controlled by this
     */
    private MainTabbedView view;
    /**
     * currently-loaded machine learning predictor
     */
    private MLPredictor predictor = null;
    /**
     * list of active popup windows
     */
    private List<JFrame> activePopups;
    /**
     * list of active popup window doc IDs, for convenience
     */
    private List<Integer> activePopupIDs;
    /**
     * current doc grid view attr selection model (if any)
     */
    private DocGridTableSelectorModel docGridSelectionModel = null;
    /**
     * current document grid component (if any)
     */
    private DocumentGrid documentGrid = null;
    /**
     * backing table for current document grid (if any)
     */
    DocumentGridTable documentGridTable = null;
    /*
     * list of predicates for document disabling
     */
    private Map<AttrValPredicate, Boolean> disabledAttrValsMap;
    /*
     * current string for search
     */
    private String searchText;
    /*
     * boolean flags for attributes currently enabled
     */
    private List<Boolean> attributesEnabled;

    /**
     * Factory method for generating a singleton MainController.
     *
     * @return the governing controller object for the visualization, or a new
     * MainController if none exist yet
     */
    public static MainController getMainController() {
        if (mainController == null) {
            mainController = new MainController();
        }
        return mainController;
    }

    /**
     * private constructor for use with the static factory method.
     */
    private MainController() {
        activePopups = new ArrayList<>();
        activePopupIDs = new ArrayList<>();
        disabledAttrValsMap = new HashMap<>();
        searchText = "";
    }

    /**
     * ***** basic setters ******
     */
    /**
     * Associates the controller with a back-end MainModel data source.
     *
     * @param model the model with which this controller should be associated.
     */
//    public void setModel(MainModel model) {
//        this.model = model;
//
//        if (predictor != null) {
//            predictor.loadPredictions(model);
//        }
//
//        // update view once model loading is complete
//        if (view != null) view.resetAllViews();
//    }
    /**
     * Associates the controller with a back-end NLP prediction module.
     *
     * @param predictor nlp / ml module which should be used for predictions
     */
//    public void setPredictor(MLPredictor predictor) {
//        this.predictor = predictor;
//
//        if (view != null) {
//            view.resetAllViews();
//            attributesEnabled = predictor.getAttributeEnabledList();
//            attributeSelectionUpdated(attributesEnabled);
//        }
//    }
    /**
     * Associates the controller with a back-end NLP prediction module.
     *
     * @param predictorFile file serving as a list of all individual Weka models
     * and related meta information to include in this MLPredictor
     */
    public void setPredictor(final File predictorFile) {

        // parse predictor modellist file
        if (view != null) {
            view.startProgressBar();
        }
        // load predictor in its own thread, so that the interface is not frozen
        Runnable runnable = new Runnable() {

            @Override
            public void run() {
                predictor = MLPredictor.buildPredictorFromXMLModelList(predictorFile);
                if (model != null && predictor != null) {
                    predictor.loadPredictions(model);
                }
                attributesEnabled = predictor.getAttributeEnabledList();
                if (view != null && model != null) {
                    view.resetAllViews();
                }
                if (view != null) {
                    view.stopProgressBar();
                }
            }
        };
        new Thread(runnable).start();

    }

    /**
     * Associates the controller with a front-end MainView to which view events
     * should be pushed.
     *
     * @param view the MainView with which this controller is associated.
     */
    public void setView(MainTabbedView view) {
        this.view = view;
    }

    /**
     * Associates the controller with a new back-end MainModel loaded from a
     * doclist file. Refreshes the visualization after loading is complete.
     *
     * @param file doclist file pointing the resources required by MainModel.
     */
    public void setModelFromDoclist(final File file) {

        // load new model from doclist
        // TODO add support for dataset types beyond MpqaColon

        // if type == mpqa_colon {
        if (view != null) {
            view.startProgressBar();
        }
        model = new MpqaColonMainModel(this);
        // load model in its own thread, so that the interface is not frozen
        Runnable runnable = new Runnable() {

            @Override
            public void run() {
                ((MpqaColonMainModel) model).loadDataFromDoclist(file);
                // update view once model loading is complete
                if (model != null && predictor != null) {
                    predictor.loadPredictions(model);
                }
                if (view != null && predictor != null) {
                    view.resetAllViews();
                }
                if (view != null) {
                    view.stopProgressBar();
                }
            }
        };
        new Thread(runnable).start();

    }

    /**
     * ***** on-updated methods ******
     */
    /**
     * This method is called when the list of selected attributes (for a
     * boolean-selection-based view) is changed. This method is responsible for
     * pushing updates to all relevant views and view-backing intermediate
     * models.
     *
     * @param newSelectedAttributes boolean list indicating whether or not each
     * attribute is selected.
     */
    public void attributeSelectionUpdated(List<Boolean> newSelectedAttributes) {

        attributesEnabled = newSelectedAttributes;

        // indicate to main view that all relevant displays should be redrawn / rebuilt
        view.attributeSelectionChanged();

        // rebuild table models for all active document popups
        for (JFrame popup : activePopups) {
            ((DocFocusPopup) popup).rebuildDocDetailsTable();
        }

    }

    /**
     * Called when attributes for a target document have been updated; is
     * responsible for pushing out updates to relevant views.
     *
     * @param docGlobalID
     */
    public void documentAttributesUpdated(int docGlobalID) {
        if (view != null) {
            // refresh all relevant tables
            view.attributeSelectionChanged();
            // rebuild table models for all active document popups
            for (JFrame popup : activePopups) {
                ((DocFocusPopup) popup).rebuildDocDetailsTable();
            }
        }
    }

    /**
     * Updates the value of a particular attribute for a particular document.
     * NOTE: because this method may be called from multiple threads running in
     * parallel (ie, from separate doc details windows), we should make sure
     * it's synchronized
     *
     * @param docID
     * @param docAttr
     * @param docAttrVal
     */
    public synchronized void updateDocumentAttr(int docID, String docAttr, String docAttrVal) {
        if (model != null) {
            // update value in model
            model.updateDocumentAttr(docID, docAttr, docAttrVal);
            // update value in applicable visual tables
            documentGridTable.setString(docID, docAttr, docAttrVal);
        }
    }

    /**
     * Unhighlights all documents in all applicable views.
     *
     */
//    public void unhighlightAllDocs() {
//        documentGrid.resetHighlightPredicate();
//    }
    /**
     * Hides documents which have certain value for particular attribute.
     *
     * @param attrName
     * @param attrValue
     */
    public void disableDocsWithAttrVal(String attrName, String attrValue) {
        AttrValPredicate pred = new AttrValPredicate(attrName, attrValue);
        disabledAttrValsMap.put(pred, true);
        attrValPairsUpdated();
    }

    /**
     * Ensures that documents which have certain value for particular attribute
     * are visible.
     *
     * @param attrName
     * @param attrValue
     */
    public void enableDocsWithAttrVal(String attrName, String attrValue) {
        AttrValPredicate pred = new AttrValPredicate(attrName, attrValue);
        if (disabledAttrValsMap.containsKey(pred)) {
            disabledAttrValsMap.remove(pred);
        }
        attrValPairsUpdated();
    }

    /**
     * Ensures that all documents are visible.
     */
    public void enableAllDocs() {
        disabledAttrValsMap.clear();
        attrValPairsUpdated();
        if (docGridSelectionModel != null) {
            docGridSelectionModel.resetVarBarCharts();
        }
    }

    /**
     * Builds the search query string representing a particular combination of
     * (attribute,value) pairs to hide.
     */
    private void attrValPairsUpdated() {
        // update appropriate components
        // build predicate string for Prefuse components
        StringBuilder predDisabledAttrValsBuilder = new StringBuilder();
        Set<AttrValPredicate> keySet = disabledAttrValsMap.keySet();
        Iterator<AttrValPredicate> keySetIterator = keySet.iterator();
        while (keySetIterator.hasNext()) {
            AttrValPredicate pred = keySetIterator.next();
//            predDisabledAttrValsBuilder.append(pred.getTrueStrPred());
            predDisabledAttrValsBuilder.append(pred.getFalseStrPred());
            if (keySetIterator.hasNext()) {
//                predDisabledAttrValsBuilder.append(" OR ");
                predDisabledAttrValsBuilder.append(" AND ");
            }
        }
        // push string to appropriate Prefuse components
        String predDisabledAttrVals = predDisabledAttrValsBuilder.toString();
        if (documentGrid != null) {
            documentGrid.resetDocsVisiblePredicate(predDisabledAttrVals);
        }

    }

    public void setSearchText(String text) {
        searchText = text;
        // update relevant views
        view.setSearchText(searchText);
    }

    public String getSearchText() {
        return searchText;
    }

    /**
     * ***** back-end predictor-interaction methods ******
     */
    /**
     * Returns whether a back-end model contains a prediction for a given
     * attribute for a given document.
     *
     * @param globalDocId
     * @param attrName
     * @return
     */
    public boolean hasPrediction(int globalDocId, String attrName) {
        if (predictor != null) {
            return predictor.hasPrediction(globalDocId, attrName);
        }
        return false;
    }

    /**
     * Gets from the back-end model its prediction for a given attribute for a
     * given document.
     *
     * @param globalDocId
     * @param attrName
     * @return
     */
    public PredictionCertaintyTuple getPrediction(int globalDocId, String attrName) {
        if (predictor != null) {
            return predictor.getPrediction(globalDocId, attrName);
        }
        return null;
    }

    /**
     * Builds attribute-predictor-sensitive summary, focusing on the regions of
     * text containing highly-weighted features.
     *
     * @param globalDocId
     * @param globalAttrName
     * @return
     */
    public String getDocumentSummary(int globalDocId, String globalAttrName) {
        if (model != null && predictor != null) {
            // convert name to id
            // TODO : this is super-clunky! refactor to use a single class for attribute encapsulation!
            List<String> allAttrs = predictor.getAttributeNames();
            int globalAttrId = allAttrs.indexOf(globalAttrName);
            if (predictor != null) {
                return predictor.buildSummary(globalDocId, globalAttrId);
            }
        }
        return "";
    }

    /**
     * Returns a list of valid possible values for an attribute.
     *
     * @param attrName
     * @return
     */
    public List<String> getValuesForAttribute(String attrName) {
        if (predictor != null) {
            List<String> valList = predictor.getValuesForAttribute(attrName);
            return valList;
        }
        return new ArrayList<>();
    }

    /**
     * ***** back-end model-interaction methods ******
     */
    public Document getDocument(int globalDocId) {
        if (model != null) {
            return model.getAllDocuments().get(globalDocId);
        }
        return null;
    }

    /**
     * ***** doc-table-view methods ******
     */
    /**
     * Builds a new backing DocTableModel for a document-based table in the
     * visualization. Bases this table on the currently-loaded MainModel.
     *
     * @return backing DocTableModel, or null if no model is currently loaded.
     */
    public DocTableModel buildSimpleDocTableModel() {
        if (model != null && predictor != null) {
            DocTableModel docTableModel = new DocTableModel(model.getAllDocuments(), model.getIsDocumentEnabledList(), predictor.getAttributeNames(), attributesEnabled);
            return docTableModel;
        }
        return null;
    }

    /**
     * Builds a new backing AttrTableModel for an attribute selection table in
     * the visualization. Bases this table on the currently-loaded MainModel.
     *
     * @return backing AttrTableModel, or null if not model is currently loaded.
     */
    public AttrTableModel buildSimpleAttrSelectionTableModel() {
        if (model != null && predictor != null) {
            AttrTableModel attrTableModel = new AttrTableModel(predictor.getAttributeNames(), attributesEnabled, this);
            return attrTableModel;
        }
        return null;
    }

    /**
     * ***** document-details methods ******
     */
    /**
     * Builds and returns a backing TableModel for presenting a detailed view of
     * the attributes, predictions, certainties, and manually-annotated values
     * associated with a particular document.
     *
     * @param docGlobalId index of the target document
     * @return backing TableModel
     */
    public DocDetailsTableModel buildAttrAndPredictionModelForDoc(int docGlobalId) {

        if (model != null && predictor != null) {
            Document doc = model.getAllDocuments().get(docGlobalId);
            List<String> allAttributes = predictor.getAttributeNames();
            List<Boolean> allAttributesEnabled = attributesEnabled;

            Map<String, PredictionCertaintyTuple> attrPredictionMap = predictor.getPredictionsForDoc(docGlobalId);

            DocDetailsTableModel docDetailsTableModel = new DocDetailsTableModel(doc, docGlobalId, attrPredictionMap, allAttributes, allAttributesEnabled);
            return docDetailsTableModel;
        }
        return null;

    }

    /**
     * Rebuilds the text content of a given AbstractDocument, populating it with
     * the text of a particular target document. Also highlights and blows-up
     * particular terms of importance to the back-end NLP model for a particular
     * attribute.
     *
     * @param abstDoc AbstractDocument to have its text replaced with the target
     * document's highlighted text
     * @param globalDocId index of the target document
     * @param attrName name of the attribute for which terms should be
     * highlighted and enlarged
     */
    public void writeDocTextWithHighlights(AbstractDocument abstDoc, int globalDocId, String attrName) {

        // map attrName to int
        if (model != null && predictor != null) {
            List<String> attrs = predictor.getAttributeNames();
            int attrIndex = attrs.indexOf(attrName);
            writeDocTextWithHighlights(abstDoc, globalDocId, attrIndex);
        } else {
            System.err.println("MainController.writeDocTextWithHighlights: could not find index for attribute: " + attrName);
        }

    }

    /**
     * Rebuilds the text content of a given AbstractDocument, populating it with
     * the text of a particular target document. Also highlights and blows-up
     * particular terms of importance to the back-end NLP model for a particular
     * attribute.
     *
     * @param abstDoc AbstractDocument to have its text replaced with the target
     * document's highlighted text
     * @param globalDocId index of the target document
     * @param globalAttrId index of the target attribute
     */
    public void writeDocTextWithHighlights(AbstractDocument abstDoc, int globalDocId, int globalAttrId) {

        if (model != null && predictor != null) {
            predictor.writeDocTextWithHighlights(abstDoc, globalDocId, globalAttrId);
        }
    }

    /**
     * Constructs a new window for presenting a single document in detail, ie,
     * in terms of its text and attribute values. This method should generally
     * only be called by displayDocDetailsWindow, after that method checks for
     * the existence of the details window for the target document.
     *
     * @deprecated
     * @param docGlobalID index of target document
     * @return new top-level container for target doc, or null if there's no
     * mainmodel
     */
    private JFrame buildDocDetailsWindow(int docGlobalID) {
        if (model != null && predictor != null) {
            Document doc = model.getAllDocuments().get(docGlobalID);
            JFrame popup = new DocFocusPopup(doc, docGlobalID);
            activePopups.add(popup);
            activePopupIDs.add(docGlobalID);
            return popup;
        }
        return null;
    }

    /**
     * Displays a window for presenting a single document in detail, ie, in
     * terms of its text and attribute values. If the target window already
     * exists, attention is brought to the target window. Otherwise, a new
     * window is created.
     *
     * @deprecated
     * @param docGlobalID index of the target document to display
     */
    public void displayDocDetailsWindow(int docGlobalID) {

        // if window is already open for doc, bring to front
        int docGlobalIdIndex = -1;
        for (int p = 0; p < activePopupIDs.size(); p++) {
            if (activePopupIDs.get(p) == docGlobalID) {
                docGlobalIdIndex = p;
                break;
            }
        }

        if (docGlobalIdIndex != -1) {
            JFrame popup = activePopups.get(docGlobalIdIndex);
            popup.toFront();
        } else {
            // else, popup new window in a separate thread
            final JFrame newPopup = buildDocDetailsWindow(docGlobalID);
            java.awt.EventQueue.invokeLater(new Runnable() {

                public void run() {
                    newPopup.setVisible(true);
                }
            });
        }
    }

    /**
     * Removes a target document's details popup from the controller's internal
     * tracking. This should be called whenever the details window is closed.
     *
     * @deprecated
     * @param popup window to be closed
     * @return true if popup was being tracked by controller, false otherwise
     */
    public boolean removeDocDetailsWindow(JFrame popup) {

        if (activePopups.contains(popup)) {
            int popupIndex = activePopups.indexOf(popup);
            activePopups.remove(popup);
            activePopupIDs.remove(popupIndex);
            return true;
        }
        // shouldn't happen? all popups should be in activePopups?
        return false;

    }

    /**
     * ***** document-grid-view methods ******
     */
    public DocumentGrid getDocumentGrid() {
        if (documentGrid != null) {
            return documentGrid;
        }
        return null;
    }

    /**
     * Builds DocumentGrid view from the current backing model.
     *
     * @return DocumentGrid to be loaded into the mainview
     */
    public DocumentGrid buildDocumentGrid() {

        // default values for axes; these should be eliminated and overridden
        String xAxisAttrName = "Indicator_26";
        String yAxisAttrName = "Indicator_4";
//        String shapeAttrName = "";
        String colorAttrName = "INDICATOR_19B";
        if (docGridSelectionModel != null) {
            // if docGridSelectionModel == null, something probably wasn't initialized correctly in the mainview?
            xAxisAttrName = ((DocGridTableSelectorModel) docGridSelectionModel).getXAxisAttribute();
            yAxisAttrName = ((DocGridTableSelectorModel) docGridSelectionModel).getYAxisAttribute();
//            shapeAttrName = ((DocGridTableSelectorModel) docGridSelectionModel).getShapeAttribute();
            colorAttrName = ((DocGridTableSelectorModel) docGridSelectionModel).getColorAttribute();
        }

        // build table for grid
        documentGridTable = new DocumentGridTable(predictor.getAttributeNames(), model.getAllDocuments(), model.getIsDocumentEnabledList());
        // build, return grid (while maintaining reference)
        documentGrid = new DocumentGrid(documentGridTable, xAxisAttrName, yAxisAttrName, colorAttrName);
        return documentGrid;

    }

    /**
     * similar to buildDocumentGrid(), but rather than rebuilding the grid from
     * scratch, simply updates the attributes by which the grid is laid out
     * based on the appropriate TableModel.
     *
     */
    public void updateDocumentGrid() {

        String xAxisAttrName = "";
        String yAxisAttrName = "";
//        String shapeAttrName = "";
        String colorAttrName = "";
        if (docGridSelectionModel != null) {
            xAxisAttrName = ((DocGridTableSelectorModel) docGridSelectionModel).getXAxisAttribute();
            yAxisAttrName = ((DocGridTableSelectorModel) docGridSelectionModel).getYAxisAttribute();
//            shapeAttrName = ((DocGridTableSelectorModel) docGridSelectionModel).getShapeAttribute();
            colorAttrName = ((DocGridTableSelectorModel) docGridSelectionModel).getColorAttribute();
        }

        // build table for grid
        if (documentGrid != null) {
            documentGrid.updateXAxis(xAxisAttrName);
            documentGrid.updateYAxis(yAxisAttrName);
//            documentGrid.updateShapeAttr(shapeAttrName);
            documentGrid.updateColorAttr(colorAttrName);
            documentGrid.updateView();
        }

    }

    /**
     * Resets the documentgrid view, causing it to perform necessary layout,
     * preforce, and other operations.
     */
    public void resetDocGridView() {
        if (documentGrid != null) {
            documentGrid.updateView();
        }
    }

    /**
     * Highlights documents matching attribute value criteria in applicable
     * views.
     *
     * @param attrName
     * @param attrValue
     */
//    public void highlightDocsWithAttrVal(String attrName, String attrValue) {
//        // TODO : apply to more general case
//        // for now, assume only a single highlight set at a time
//        documentGrid.setHighlightPredicate(attrName, attrValue);
//    }

    /**
     * Builds and returns a new backing table model for the table used to select
     * attributes for the document grid view.
     *
     * @return backing DocGridTableSelectorModel
     */
    public DocGridTableSelectorModel buildSimpleDocGridSelectionTableModel() {
        DocGridTableSelectorModel newDocGridTableModel = new DocGridTableSelectorModel(predictor.getAttributeNames());
        docGridSelectionModel = newDocGridTableModel;
        return docGridSelectionModel;
    }

    public DocGridDragControl getDocDragControl() {
        if (documentGrid != null) {
            return documentGrid.getDragControl();
        }
        return null;
    }

    public DocumentSelectControl getDocSelectControl() {
        if (documentGrid != null) {
            return documentGrid.getSelectControl();
        }
        return null;
    }

    /**
     * ***** interactive-bar-chart methods ******
     */
    /**
     * Builds a VarBarChartForCell display for a given attribute. Returned
     * display is meant to be used as cell in table.
     *
     * @param attrName name of target attribute for which display shoudl be
     * created
     * @return varbarchart visualization for target attribute
     */
    public VarBarChartForCell getVarBarChartForCell(String attrName) {
        List<String> attrVals;
        if (predictor != null) {
            attrVals = predictor.getAttributeValues(attrName);
        } else {
            attrVals = new ArrayList<>();
        }
        VarBarChartForCell varBarChart = new VarBarChartForCell(attrName, attrVals, model.getAllDocuments());
        return varBarChart;
    }

    /**
     * ***** glasspane-related methods ******
     */
    /**
     * Retrieves the glasspane from the mainview for use by other requesting
     * views.
     *
     * @return
     */
    public MainViewGlassPane getGlassPane() {
        if (view != null) {
            return view.getGlassPane();
        }
        return null;
    }
}

redpajama_set_name: RedPajamaGithub


Stay up to date with our newest information and obtain new words updates, blog posts, and extra. There is a growing world population that is faced with restricted resources from the atmosphere. To relieve the pressures positioned on the finite sources available it has turn out to be more necessary to forestall waste. To realize zero waste, waste management has to maneuver from a linear system to being more cyclical in order that supplies, merchandise and substances are used as effectively as doable. Supplies must be chosen in order that it may either return safely to a cycle inside the atmosphere or remain viable within the industrial cycle.
The event of a style for one thing, whether or not it's films, literature, drama or art comes with time and experience in that area. The first novel you read produces an uncritical reaction- an emotional response, as you have nothing to compare it to however your own life experiences, …then there's the aware, essential response …where we examine what we have skilled with different issues of the same type, and form judgment of value and proportion," (61). While you educate your imagination, you discover what you like and dislike without being prejudice or naïve. You type authentic opinions and progressively enhance your style.
Arising from this large concept got here another revolutionary idea. School districts and campuses would be held responsible by policymakers and taxpayers if they didn't present a decent education for each pupil. This concept got here to be known as college accountability, and it was constructed round three principles: Creating rigorous tutorial requirements, measuring student progress in opposition to these requirements, and attaching some consequence to the outcomes.
Go to the CVER website for more data on our research programmes, coverage projects, publications and occasions. Current your whole application package with an immigration workplace in Trinidad and Tobago. In case you're elsewhere on this planet, apply at a Trinidad and Tobago mission. Overview your utility to make sure it is correct. Are you able to tell that I like Kate DiCamillo! I will put up some new assets next week!
What advocates are clear on, however, is that character is the essence of what we're. The time period comes from the world of engraving, from the Greek time period kharakter, an instrument used for making distinctive marks. Thus character is what marks a person or individuals as distinctive. You develop particular abilities relating to educational points, theories of learning, equality and diversity, education policy and follow, creativity and education, and a normal understanding of education in social, political and financial contexts. Some courses embrace work placement modules, offering the chance to put idea into apply.


text:
Cambridge Publishes Charles Darwin's Secret Letters Online
Thousands of his personal letters will be published online for the first time.
By Mackenzie Yang March 31, 2013
Charles Darwin kept his theory of evolution to himself for 21 years. Now the single largest publication of Darwin's personal letters are available online, thanks to efforts by the Cambridge University Library, which holds the largest Darwin archive, including annotated books from his working library and notes from his voyage on the HMS Beagle.
The project will begin with what scholars consider the most important correspondences – some 1,200 letters – with his confidant, the botanist Joseph Hooker, according to The Independent. It seems Hooker not only supplied Darwin with exotic plant species–but also provided moral support, as both men suffered multiple family tragedies.
(MORE: Charles Darwin Garnered 4,000 Votes in a Georgia County)
While Darwin was a scientist once slandered by his fellow Victorians for proposing that animals and man share a common ancestor, the letters "give a different picture of both Darwin and the scientific enterprise, in showing it as intensely collaborative, and that it is not divorced from private life," Paul White, editor and research associate of the project, said in an interview with BBC's Newshour.
One of the most touching letters that humanizes Darwin is about losing his daughter-in-law, who had collected plant specimens for him during her own honeymoon. As Darwin wrote to Hooker in a letter that has already been published:
"I am sure you will pity us, when you hear that Amy… was seized with convulsion which lasted for several hours, she then sunk into a stupor and I saw her expire at 7 o'clock this morning…I cannot think what will become of Frank. She helped & encouraged him in his scientific work & whether he will ever have heart to go on again or what he will do I cannot conceive."
Other correspondences that are available now for viewing include the most famous one, in which Darwin confesses his initial feelings about his then developing theory: "I am almost convinced (quite contrary to opinion I started with) that species are not (it is like confessing a murder) immutable," he writes. In fact, after Darwin's infant son died of scarlet fever, he almost gave up his claim on the natural selection theory to another scientist, Alfred Russell Wallace, who was concurrently, though independently, working on it as well: "It is miserable in me," Darwin wrote "to care at all about priority."
To read more of Darwin's letters, see the archive's list of Top 10 Letters here.
MORE: Survival-of-the-Catchiest: How Music "Evolves"
MORE: The Ever Evolving Theories of Darwin

redpajama_set_name: RedPajamaCommonCrawl


The Indigenous Heterogeneity of Oportunidades: Ample or Insufficient Human Capital Accumulation?
Indigenous groups account for over one tenth of Mexico's population and many of them suffer from constant social disadvantages and extreme marginalization. One of their few paths out of poverty is through the accumulation of human capital, which is a central element of Oportunidades' strategy to ameliorate trans-generational poverty. This study finds that the positive impacts of Oportunidades on enrollment for the general population are no different for indigenous households. In addition, it finds that Oportunidades impacts on repeat and illness rates are consistently marginal. Thus, it is argued that unless tailored investment in indigenous human capital accumulation and complimentary alternatives are intensified to close the existing indigenous marginalization gaps, indigenous Mexicans will remain in profound and persistent poverty due to the unique and overwhelming obstacles they face.
Bando, R., Lopez-Calva, L., and Patrinos, H., Child Labor, School Attendance, and Indigenous Households: Evidence from Mexico, World Bank Research Working Paper No. 3487 (Washington, D.C.: The World Bank, January 2005).
Becker, G.S., Human Capital (New York: National Bureau of Economic Research, 1975).
Behrman, J.R., Sengupta, P., and Todd, P., Progression through PROGRESA: An Impact Assessment of a School Subsidy Experiment, Project Papers and Briefs (Washington, D.C.: IFPRI, April 2001).
De la Brière, B., personal conversation, Conditional Cash Transfers: A Fresh Assessment, International Development Forum (Washington, D.C.: School of International Service at American University, March 28, 2006).
Coady, D., The Application of Social Cost-Benefit Analysis to the Evaluation of PROGRESA, Final report submitted to PROGRESA. (Washington, D.C.: IFPRI, 2000).
Currie, J., Welfare and the Well Being of Children: Fundamentals of Pure and Applied Economics (Chur, Switzerland: Harwood Academic, 1995).
Gertler, P., The Impact of PROGRESA on Health, Final reported submitted to PROGRESSA (Washington, D.C.: IFPRI, 2000).
Gertler, P., Do Conditional Cash Transfers Improve Child Health? Evidence from PROGRESA's Control Randomized Experiment, Health, Health Care, and Economic Development, Vol. 94, No. 2 (May 2004), pp. 336-341.
Hanson, G., Globalization, Labor Income, and Poverty in Mexico, NBER Working Paper No. 11027 (San Diego, CA: University of San Diego, 2005).
Hoddinott, J., Skoufias, E., and Washburn, R., The Impacts of PROGRESA on Consumption, Final report submitted to PROGRESSA (Washington, D.C: IFPRI, 2000).
Grosh, M., Administering Targeting Social Programs in Latin America: From Platitudes to Practice (Washington, D.C.: The World Bank, 1994).
Ilahi, N., Orazem, O., and Sedlacek, G., The Implications of Child Labor and Adult Wages, Income, and Poverty: Retrospective Evidence from Brazil, mimeo (Washington, D.C.: The World Bank, 2000).
Inter-American Development Bank (IDB) America, Mexico's Oportunidades: An Interview with Miguel Szekely, Undersecretary of Social Development, IDB America Online; available from http://www.iadb.org/idbamerica/index.cfm?thisid=3169; Internet; accessed on November 20, 2005.
Inter-American Development Bank (IDB) America, The Story Behind PROGRESA, IDB America Online; available from http://www.iadb.org/idbamerica/index.cfm?thisid=3049; Internet; accessed on November 20, 2005.
International Food Policy Research Institute (IFPRI), PROGRESA, IFPRI Online; available from http://www.ifpri.org/themes/progresa.htm; Internet; accessed on November 20, 2005.
Levy, S. and Rodriguez, E., Economic Crisis, Political Transition and Poverty Policy Reform: Mexico's PROGRESA-Oportunidades Program (Washington, D.C: IDB, 2004).
Lipton, M. and Ravallion, M., Poverty and Policy, Handbook of Development Economics, Vol. III., ed. by Behrman and Srinivasan (North-Holland, 1999), pp. 2553-2675.
Maluccio, J., Coping with the 'Coffee Crisis' in Central America: The Role of the Nicaraguan Red de Protección Social, FCND Discussion Paper, No. 188 (Washington, D.C.: IFPRI, February 2005).
Mayer, S.E., What Money Can't Buy: Family Income and Children's Life Chances (Cambridge, MA: Harvard University Press, 1997).
McEwan, P.J., The Indigenous Test Score Gap in Bolivia and Chile, Economic Development and Cultural Change, Vol. 53, No. 1 (October 2005), pp. 157-190.
Mincer, J., Schooling, Experience, and Earnings (New York: Columbia University Press, 1974).
De la O Campos, A.P., personal conversation (Washington, D.C.: School of International Service at American University, April 4, 2006).
Parker, S.W. and Teurel, G., Schooling Inequality and Language Barriers, Documento de Trabajo, Centro de Investigación y Docencia Económicas (Mexico, 2003).
Psacharopoulos, G., Ethnicity, Education, and Earnings in Bolivia and Guatemala, Comparative Education Review, Vol. 37, No. 1, Special Issues on Ethnicity (February 1993), pp. 9-20.
Psacharopoulos, G. and Patrinos, H., Indigenous People and Poverty in Latin America (Washington, D.C.: The World Bank, 1996).
Ravallion, M., The Mystery of the Vanishing Benefits: Ms. Speedy Analyst's Introduction to Evaluation, World Bank Economic Review Vol. 15, No. 1, (2001), pp. 115-140.
Shultz, T.P., Investing in Human Capital, American Economic Review, Vol. 51, No. 1 (March 1961), pp. 1-17.
Shultz, T.P., The Impact of PROGRESA on School Enrollments, Final report submitted to PROGRESA, (Washington, D.C.: IFPRI, 2000).
Skoufias, E. and Parker, S.W., Conditional Cash Transfers and their Impact on Child Work and Schooling: Evidence from the PROGRESA Program in Mexico, FCND Discussion Paper, No. 123 (Washington D.C: IFPRI, 2001).
Skoufias, E., PROGRESA and its Impacts on the Welfare of Rural Households in Mexico, Research Report, No. 139 (Washington, D.C.: IFPRI, 2005).


Trident DMG: Bold. Savvy. Impactful. Click to learn more about us.
Trident DMG is a strategic communications, public relations, and crisis management firm. We fiercely advocate for our clients and have three touchstones: be the smartest; work the hardest; and deliver the most. We master our clients' businesses, leveraging communications to help them achieve their goals. We advise leading innovators, disruptors, and investors, Fortune 500s, global CEOs, and life-changing NGOs.
Tech public relations requires executing at the foundational levels. While there are many steps to take beyond the basics, you need to get the basics right. If you can't block and tackle, you'll never gain a yard.


text:
Q: virtual list control scrolling is painfully slow I subclassed from CMFCListControl and create a list control in Report View (LVS_REPORT) to display data.  As my data contains a million records, populating the list control was slow AF upfront (6 minutes on average), but very fluid after.  I switched to the virtual list control using the LVS_OWNERDATA window style.  It works BETTER (75 seconds in debug), HOWEVER, after the initial display, ANY attempt to scroll is painfully slow.  It works, and never crashes, but it takes 2 minute to display the change.  The data read is in a std::map in memory, so disk drives or network latency issues are not the cause.
void CAlbumListCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult)
{
    NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
    LVITEM &Item = (pDispInfo)->item;
    CString csTemp;

    ASSERT(m_pLibrary);
    if (!m_pLibrary)
        AfxThrowMemoryException();

    const CImageEntry *pEntry = m_pLibrary->GetImageEntryAt((size_t)Item.iItem);
    //pListCtrl->SetItemText(nCount, 1, pEntry->GetItemName().c_str());
    //pListCtrl->SetItemText(nCount, 2, pEntry->GetPathName().c_str());
    //pListCtrl->SetItemText(nCount, 3, pLib->GetImageEntryType(pEntry).c_str());

    if (Item.mask & LVIF_TEXT) //valid text buffer?
    {
        switch (Item.iSubItem)
        {
        case 0: //fill in ID
            //_tcscpy_s(Item.pszText, Item.cchTextMax,
            //  m_Items[iItem].m_strItemText);
            csTemp.Format(_T("%ld"), pEntry->GetItemId());
            _tcscpy_s(Item.pszText, Item.cchTextMax, csTemp);
            break;
        case 1: //fill in sub item 1 text
            _tcscpy_s(Item.pszText, Item.cchTextMax, pEntry->GetItemName().c_str());
            break;
        case 2: //fill in sub item 2 text
            _tcscpy_s(Item.pszText, Item.cchTextMax, pEntry->GetPathName().c_str());
            break;
        case 3: //fill in sub item 1 text
            _tcscpy_s(Item.pszText, Item.cchTextMax, m_pLibrary->GetImageEntryType(pEntry).c_str());
            break;
        //case 2: //fill in sub item 2 text
            //  _tcscpy_s(Item.pszText, Item.cchTextMax, pEntry->GetPathName().c_str());
            //  break;
        default:
            break;
        }
    }

    *pResult = 0;
}

int CAlbumView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CWnd::OnCreate(lpCreateStruct) == -1)
        return -1;

    m_wndTabCtrl.Create(TCS_TABS | TCS_FIXEDWIDTH | WS_CHILD | WS_VISIBLE,
            CRect(0, 0, 20, 20), this, IDC_ALBUMVIEW_HEADERTAB);

    if (!m_wndTabCtrl.m_hWnd)
        return -1;

    m_wndTabCtrl.InsertItem(0, _T("List View"));
    m_wndTabCtrl.InsertItem(1, _T("Tree View"));

    m_listCtrl.Create(LVS_REPORT | LVS_SHOWSELALWAYS | LVS_OWNERDATA | WS_VISIBLE, CRect(0, 0, 20, 20), this, IDC_LISTCTRL);
    m_listCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_ONECLICKACTIVATE);
    m_listCtrl.InsertColumn(0, _T("ID"), LVCFMT_CENTER, 150);
    m_listCtrl.InsertColumn(1, _T("Nickname"), LVCFMT_CENTER, 100);
    m_listCtrl.InsertColumn(2, _T("Image File Pathname"), LVCFMT_CENTER, 500);
    m_listCtrl.InsertColumn(3, _T("Image Type"), LVCFMT_CENTER, 100);
    m_listCtrl.InsertColumn(4, _T("Dimensions"), LVCFMT_CENTER, 75);
    m_listCtrl.InsertColumn(5, _T("Color Depth"), LVCFMT_CENTER, 95);
    m_listCtrl.InsertColumn(6, _T("Tags"), LVCFMT_CENTER, 150);

    m_treeCtrl.Create(TVS_HASBUTTONS | WS_VISIBLE, CRect(0, 0, 20, 20), this, IDC_TREECTRL);

    SetVisibleViewCtrl(0);

    return 0;
}

void CAlbumView::UpdateView()
{
    std::map<wstring, vector<wstring>> mapImageFilesByFolder;
    time_t start = time(NULL);
    auto *pFrame = GetParentFrame();
    size_t nCount = 0;
    if (pFrame)
    {
        CImageLibrary *pLib = pFrame->GetImageLibrary();
        CAlbumView *pView = pFrame->GetAlbumView();
        CAlbumListCtrl *pListCtrl = pView->GetListCtrl();
        CAlbumTreeCtrl *pTreeCtrl = pView->GetTreeCtrl();
        CUpdatingViewDlg dlg;
        dlg.Create(this);
        dlg.ShowWindow(SW_SHOW);
        dlg.CenterWindow();
        dlg.RedrawWindow();
        pListCtrl->SendMessage(WM_SETREDRAW, FALSE);
        pTreeCtrl->SendMessage(WM_SETREDRAW, FALSE);
        nCount = pLib->GetImageCount();
        pListCtrl->SetItemCountEx((int)nCount);
        pListCtrl->SetImageLibrary(pLib);
        SetThreadPriority(GetCurrentThread(), 7);
        POSITION pos = pLib->EnumImageEntries();
        if (::IsWindow(pListCtrl->m_hWnd))
        {
            pListCtrl->DeleteAllItems();
            pTreeCtrl->DeleteAllItems();
            int nCount = 0;
            while (pos != (POSITION)-1)
            {
                CString csTemp;
                const CImageEntry *pEntry = pLib->GetCurrentImageEntry(pos);
                csTemp.Format(_T("%ld"), pEntry->GetItemId());
                pListCtrl->InsertItem(nCount, csTemp);
                //pListCtrl->SetItemText(nCount, 1, pEntry->GetItemName().c_str());
                //pListCtrl->SetItemText(nCount, 2, pEntry->GetPathName().c_str());
                //pListCtrl->SetItemText(nCount, 3, pLib->GetImageEntryType(pEntry).c_str());
                //pTreeCtrl->ParseAndAddFile(pEntry->GetPathName().c_str());
                pos = pLib->GetNextPos(pos);
                ++nCount;
            }

            CString csTemp;
            csTemp.Format(_T("Done in %d seconds."), time(NULL) - start);
            MessageBox(csTemp, _T("X"));

            SetThreadPriority(GetCurrentThread(), 0);
            pListCtrl->SendMessage(WM_SETREDRAW, TRUE);
            pListCtrl->RedrawWindow(NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
            pTreeCtrl->SendMessage(WM_SETREDRAW, TRUE);
            pTreeCtrl->RedrawWindow(NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
            dlg.ShowWindow(SW_HIDE);
            dlg.DestroyWindow();
        }
    }
}

A: So you create a LVS_OWNERDATA (virtual) list-view control and set its style to LVS_REPORT. Btw, isn't a rectangle of (0,0,20,20) too small? But I see you are using the same coordinates for other controls as well, so I guess you re-arrange them later (code not shown here).
The function processing the LVN_GETDISPINFO notification must be declared in your class's message-map, to associate the function to the message:
BEGIN_MESSAGE_MAP(CAlbumView, ...)
    .
    .
    ON_NOTIFY(LVN_GETDISPINFO, IDC_LISTCTRL, &CAlbumView::OnLvnGetdispinfoListCtlr)
END_MESSAGE_MAP()

This is what wizard-generated code would look like, if you didn't subclass from CMFCListControl and instead simply used CMFCListControl as is. But you create the control yourself, so please disregard this remark if you have correctly made the aforementioned declaration in the child class's message-map and you found that the function is actually called (debug or trace).
I think the reason why your code doesn't work is because you copy the items' texts to a buffer supposedly pointed by the pszText instead of setting the pszText pointer. Here is a excerpt from the documentation about the LV_ITEM structure:
pszText
If the structure specifies item attributes, pszText is a pointer to a null-terminated string containing the item text. When responding to an LVN_GETDISPINFO notification, be sure that this pointer remains valid until after the next notification has been received.
Also:
cchTextMax
This member is only used when the structure receives item attributes. ... It is read-only during LVN_GETDISPINFO and other LVN_ notifications.
And the example in the LVN_GETDISPINFO documentation does exactly this.
So, your code could be changed as shown below:
    void CAlbumListCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult)
    {
        NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
        LVITEM &Item = (pDispInfo)->item;
        CString csTemp;
        static TCHAR _szItemId[20]; // Persistent buffer

        ASSERT(m_pLibrary);
        if (!m_pLibrary)
            AfxThrowMemoryException();

        const CImageEntry *pEntry = m_pLibrary->GetImageEntryAt((size_t)Item.iItem);

        if (Item.mask & LVIF_TEXT) //Item/subItem text
        {
            switch (Item.iSubItem)
            {
            case 0: //fill in ID
                csTemp.Format(_T("%ld"), pEntry->GetItemId());
                 _tcscpy_s(_szItemId, csTemp);
                Item.pszText = _szItemId;
                break;
            case 1: //fill in sub item 1 text
                Item.pszText = pEntry->GetItemName().c_str();
                break;
            case 2: //fill in sub item 2 text
                Item.pszText = pEntry->GetPathName().c_str();
                break;
            case 3: //fill in sub item 3 text
                Item.pszText = m_pLibrary->GetImageEntryType(pEntry).c_str();
                break;
            default:
                break;
            }
        }

        *pResult = 0;
    }

Notes:

*

*I only modified this code in a text editor, it's not actually tested. It may need some minor fixes to even compile.

*The InsertItem() and DeleteAllItems() calls (along with that browsing of the list) must be removed, as the control does not really store any content, instead it requests the data of the items being displayed, through the LVN_GETDISPINFO message (referenced by the item's index - iItem).

redpajama_set_name: RedPajamaStackExchange


text:
Q: GCD for simple download queue I want to create a simple download queue, i don't need much functionality, just a serial queue so that when i run my download process it will just wait for the first download to finish before starting the second ect.  Im using parse-server which runs its query and get data functions in the background anyway but it seems to run things concurrently.
I was thinking of just using GCD as i don't directly see the need to use create NSURL sessions to download my files when parse-server functionality is handling this.
To this end i have defined a queue:
let downloadQueue = DispatchQueue(label: "downloadQueue", qos: .background)

And then thought that wrapping my download function in this queue would add the items to be downloaded to the back of the queue.  However this doesn't seem to happen, and files begin downloading as soon as they are selected.
func downloadDataToDevice(cell: JourneyCollectionViewCell, selectedIndexPath: IndexPath){

    self.downloadQueue.async {

        // query and progressBlock to track download progress
    }
}

A: Creating the DispatchQueue
We'll have to go into a bit more detail in order for you to determine the cause of the issue. First, the dispatchQueue you created is a serial queue. This means any blocks that are added to the queue will be executed in a serial fashion. GCD makes no guarantee over the timing of these executions, only the order in which they are executed. Keep in mind that GCD does not specify what thread your code is going to be executed on, only that it will treat the quality of service as .background.
Adding Blocks
Now, when adding blocks of code to your serial queue, you call either the .sync or the .async methods on the queue. These classifiers do determine whether or not the block of code you are adding to the queue will be executed sync or async relative to the current thread. So if you add a block of code .sync to the queue, GCD will block the current thread until the code executed. If you add a block of code .async to the queue, then the current thread will continue executing under the discretion of GCD. The DispatchQueue itself is still a serial queue whether or not you add a block of code .sync or .async to it.
Executing Blocks
Now on to your Parse code, because this is where is can get slightly tricky. We have established that your DispatchQueue is a serial queue. However, let's say that you add a block of code to the queue that does something in the background (like download a file) and has some callback function. From the point of view of the DispatchQueue and the thread that the block of code is running on, as soon as you initiate the background action, this block of code has finished execution, and it will move on to the next block in the queue. Here's an example to clarify a bit:
downloadQueue.async {
    Parse.doSomethingAsync("something", callback: {(error: Error) in
        // Do something else ...
    }
}

As you can see here, when GCD executes this block of code, the doSomethingAsync method will run the background depending on how the Parse API has implemented the method. If I am not mistaken, the parse API has different functions for either sync or async behavior. As soon as doSomethingAsync is called and begins execution in the background, this block of code has finished execution and GCD can then begin executing the next block of code ... even though from your point of view the code is not yet finished, because the file is not done downloading.
The following code does not suffer from this issue:
downloadQueue.async {
    Parse.doSomethingSync("something", callback: {(error: Error) in
        // Do something else ...
    }
}

Becuase the doSomethingSync will execute the action on the current thread relative to the block and the block will halt execution until it is completed executing the doSomethingSync method.
TLDR and More Info
TLDR; You need to make sure the download action in the GCD blocks are serial and will block execution while the download is occuring.
This tutorial goes into a bit more detail on GCD: https://www.raywenderlich.com/60749/grand-central-dispatch-in-depth-part-1


text:
Q: Build HTML from javascript I have an HTML table which is built in the following way:-

            Party	 Name	 Chamber	 District	 State

            {{user.fullname}}
             {{user.chamber_name}}
            {{user.district_name}}
            {{user.state_name}}
             <button type="button" class="btn btn-primary">View Details</button>

Is it possible to create this table from javascript and in the HTML I just create a div and append the created table from javascript into this div. I tried placing the above content in a javascript variable and do an append but it did not work out. Is there a way to do this?? I think it did not work out may be because of the Angular JS variables. Correct me if I am wrong. I am pretty new to this.

A: In AngularJS use

 and save the html-code in $scope.html-var.
For that you need to include


text:
b (1250)
Comic Creator Abdou Adji Moussa
Abdou Adji Moussa
(b. 10 September 1968, Chad, Africa)
Abdou Adji Moussa was born in N'Djamena, Chad in 1968. He left high school after graduating to devote himself to drawing. A self-taught artist, he developed an interest in comics in 1992, after he met the French architect/designer Gérard Leclaire. He received many acknowledgments in Tchad. His work has been published with the collaboration of international institutions. The Réseau de Lecture Publique du Tchad co-published with the Coopération Française his comic book 'Les Sao' (a saga inspired by the oral literature of the Ciad). French publisher EDICEF published two illustrated books for children, 'Lazonie, la petite menagère' and 'Louba le petit footballeur'.
In Chad, Adji Moussa published comic strips in magazines Sahibi, Amigest and Tchad et Cultures, and he is cartoonist for the daily paper Le Progrès. His activities are not restricted to comics: he works as a graphic designer in advertising and he illustrates calendars, didactic brochures about breeding and AIDS prevention.
Adji Moussa explains his situation:
"We do not have publishers in Chad, we do not have an education because there is no school of art, and also sometimes we do not have the material for design. For these reasons we are forced to turn towards the NGO, in short we are not free to do a book of comic strips when we want to realize something. The comic strips are a means of communication, a comic book or a comic strip circulates between different people, it is an unexpensive, amusing and ironic mass media and the humor in Africa is not missing, never."
Adji Moussa participated in the XXV Festival of Angoulême, France, and has had his work exhibited in Italy, in the exhibition 'Matite Africane organized by Lai Momo and NGO CEFA.
Artwork © 2019 Abdou Adji Moussa
Website © 1994-2019 Lambiek
b(1250)
d(830)
e(242)
f(526)
g(784)
h(677)
i(107)
j(314)
k(615)
m(1188)
n(308)
o(231)
q(33)
r(729)
s(1143)
t(554)
u(65)
v(409)
w(453)
x(15)
y(97)
z(130)
Find other artists in the Comiclopedia:
Search in Comiclopedia
Series and books by Abdou Adji Moussa in stock in the Lambiek Webshop:
If you want to help us continue and improve our ever- expanding database, we would appreciate your donation through Paypal.


text:
\section{Introduction}

\begin{figure*}[t!]
\centering
\subfloat[HES]{\includegraphics[width=0.45\textwidth]{img/hes_mosaic_cropped.png}\label{subfig:hessamples}} \qquad
\subfloat[IHC]{\includegraphics[width=0.45\textwidth]{img/ihc_mosaic_cropped.png}\label{subfig:ihcsamples}}
\caption{Stain transfer translates between unpaired HES (a) and IHC (b) tiles (Gustave Roussy dataset). Cancer cells visible in IHC by the golden DAB stain. }
\label{fig:datasets}
\end{figure*}

The use of histopathological whole slide images (WSI) is considered the gold standard for the diagnosis and prognosis of cancer patients. These slides contain biopsies of pathological tissue from patients and are typically stained in order to highlight different tissue structures. One of the most common tissue staining protocols is hematoxylin and eosin staining (H\&E), sometimes augmented with saffron (HES) (Figure \ref{subfig:hessamples}). Under the H\&E protocol, the hematoxylin component stains cell nuclei with a purple-blue color, while the eosin component stains the extracellular matrix and cytoplasm in pink~\cite{suvarna2018bancroft}. Another common staining is based on immunohistochemistry (IHC) (Figure \ref{subfig:ihcsamples}). This staining involves the process of selectively identifying proteins in cells and highlighting them using a chromogen. One of the most common IHC stains is based on hematoxylin together with the diaminobenzidine (DAB) chromogen forming an H-DAB stain. Under this protocol, different staining configurations can be used, targeting different cell proteins (e.g., Ki67, HER2, hormone receptors). The resulting stained tissue can provide a distinct readout, for example with AE1/AE3, in which DAB localises on cancer cell membranes. In the case of breast cancer, the presence of metastatic cells in the axillary lymph nodes can greatly affect the prognosis of a patient. Lymph node status, assessed through the WSI inspection of dissected sentinel or axillary lymph nodes, is therefore a crucial diagnostic readout. In cases where the diagnosis is difficult to make (e.g. micro-metastasis or isolated tumor cells) IHC-stained slides that highlight cancer cells are necessary.

With the recent advances in deep learning, there is a growing interest in automatically processing digitised slides. We present a methodology to computationally transfer from H\&E to IHC WSIs. Our main contribution is a region-based discriminator network within a CycleGAN framework, which utilises automatically extracted regions of interest to improve stain localisation. Unlike fully supervised schemes, our method learns from unpaired H\&E and IHC slides and produces a stain transfer that can serve as a soft segmentation for metastasis detection. Experiments on two datasets illustrate the success of our method, while demonstrating that baseline models are unable to reliably localise the DAB stain and, consequently, cancer cells. To the best of our knowledge, this is the first work to propose such a region-guided CycleGAN, as well as the first to provide robust models for stain transfer on the WSI level. Synthesised IHC slides show the potential of our method as a clinical visualisation tool, as well as in metastasis segmentation pipelines for diagnosis.

\section{Related Work}

Generative adversarial networks (GANs) are a popular family of generative models in histopathology image analysis~\cite{tschuchnig2020generative}. Various types of GANs have been applied to histopathology images for stain transfer~\cite{xu2019gan}, stain normalisation~\cite{rana2018computational,bentaieb2017adversarial,de2018stain}, cell segmentation~\cite{hou2019robust}, data augmentation~\cite{claudio2021pathologygan} and representation learning~\cite{boyd2021self}. A widely used variant of GANs are image-to-image translation networks, such as \texttt{pix2pix}~\cite{zhu2017unpaired}, which learns to translate between image \emph{pairs}, and CycleGANs~\cite{isola2017image}, which relax the pairing assumption to enable \emph{unpaired} and fully unsupervised image-to-image translation. CycleGANs have been used for stain transfer before, notably in \cite{xu2019gan}, which augments the CycleGAN training criterion with additional priors, so as to guide an otherwise unsupervised model.

Region of interest (RoI) information is one possible enrichment to a generative learning task, in conjunction with attention mechanisms. In \cite{savioli2018generative}, a CoGAN-inspired setup~\cite{liu2016coupled} is used for joint generation of global and RoI images. In~\cite{ouyang2018pedestrian}, pedestrians are edited into predefined scenes using \texttt{pix2pix}, with spatial pyramid pooling in the discriminator for direct scrutiny. Pre-trained R-CNN object detection systems have been used to propose regions during GAN training in~\cite{huang2019realistic}, or as a feature extractor in object-driven GANs~\cite{li2019object}. In contrast, we modify the GAN discriminator itself, and leverage automatically derived RoI data.

\section{Method}
\label{sec:methods}
CycleGANs~\cite{zhu2017unpaired} lend themselves to the task of stain transfer between unpaired histopathology tiles. These are unsupervised models incorporating two GAN generators, $G_{XY} : X \to Y$ and $G_{YX} : Y \to X$ for \emph{unpaired} image domains $X$ and $Y$. In an application of stain transfer between two stains, each stain represents a different domain. Although both generators are trained, in our case only one direction of transfer is desired (HES $\to$ IHC), and the other generator may be discarded after training. CycleGAN training is performed according to,

\begin{align}
\min_{G_{XY}, G_{YX}}\max_{D_X, D_Y} &{}\mathcal{L}_{CG} = \mathcal{L}_{GAN}(D_Y, G, X, Y) + \mathcal{L}_{GAN}(G_{XY}, D_Y, X, Y)\label{eq:cycle_gan}\\
&+ \lambda_{CYC}\mathcal{L}_{CYC}(G_{XY}, G_{YX}, X, Y) \notag + \lambda_{ID}\mathcal{L}_{ID}(G_{XY}, G_{YX}, X, Y), \notag
\end{align}

which combines least squares adversarial losses~\cite{mao2017least} $\mathcal{L}_{GAN}$, with PatchGAN discriminators $D_X$ and $D_Y$, along with a cycle-consistency loss $\mathcal{L}_{CYC}$ to maintain pixel-wise consistency back and forth between domains, identity function losses $\mathcal{L}_{ID}$ for stability, and $\lambda_{CYC}$ and $\lambda_{ID}$ are hand-tuned weights.

\subsection{Region of interest discrimination}
\label{subsec:roi_disc}

\begin{figure*}[t]%
    \centering

    \subfloat[Patch-based discriminator]{
    \tikzset{every picture/.style={line width=0.25pt}}
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]

\draw    (100,4) -- (100,76) ;
\draw    (28,76) -- (100,76) ;
\draw    (60,4) -- (60,76) ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (200,28) -- (208,28) -- (208,36) -- (200,36) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (208,36) -- (216,36) -- (216,44) -- (208,44) -- cycle ;
\draw    (200,52) -- (212,52) ;
\draw    (212,52) -- (224,52) ;
\draw    (224,40) -- (224,52) ;
\draw    (224,28) -- (224,40) ;
\draw    (68,4) -- (100,4) ;
\draw    (28,44) -- (28,76) ;
\draw    (28,36) -- (100,36) ;
\draw    (68,44) -- (100,44) ;
\draw    (28,52) -- (100,52) ;
\draw    (28,60) -- (44,60) ;
\draw    (32,4) -- (32,76) ;
\draw    (36,4) -- (36,76) ;
\draw    (40,4) -- (40,76) ;
\draw    (44,60) -- (44,76) ;
\draw    (48,4) -- (48,76) ;
\draw    (52,4) -- (52,76) ;
\draw    (56,4) -- (56,76) ;
\draw    (64,4) -- (64,76) ;
\draw    (68,44) -- (68,76) ;
\draw    (72,4) -- (72,76) ;
\draw    (76,4) -- (76,76) ;
\draw    (80,4) -- (80,76) ;
\draw    (84,60) -- (84,76) ;
\draw    (88,4) -- (88,76) ;
\draw    (92,4) -- (92,76) ;
\draw    (96,4) -- (96,76) ;
\draw    (28,8) -- (100,8) ;
\draw    (28,12) -- (100,12) ;
\draw    (28,16) -- (100,16) ;
\draw    (28,20) -- (44,20) ;
\draw    (28,24) -- (100,24) ;
\draw    (28,32) -- (100,32) ;
\draw    (28,68) -- (100,68) ;
\draw    (28,40) -- (100,40) ;
\draw    (28,48) -- (100,48) ;
\draw    (28,56) -- (100,56) ;
\draw    (28,64) -- (100,64) ;
\draw    (28,72) -- (100,72) ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (28,4) -- (68,4) -- (68,44) -- (28,44) -- cycle ;
\draw    (216,28) -- (216,36) ;
\draw    (200,36) -- (200,52) ;
\draw    (224,28) -- (208,28) ;
\draw    (224,36) -- (216,36) ;
\draw    (208,44) -- (208,52) ;
\draw    (208,44) -- (200,44) ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (44,20) -- (84,20) -- (84,60) -- (44,60) -- cycle ;
\draw    (44,4) -- (44,20) ;
\draw    (84,20) -- (100,20) ;
\draw    (28,28) -- (100,28) ;
\draw    (84,60) -- (100,60) ;
\draw    (84,4) -- (84,20) ;
\draw    (224,44) -- (216,44) ;
\draw    (216,44) -- (216,52) ;
\draw    (108,76) -- (192,52.72) ;
\draw    (108,76) -- (108,4) ;
\draw    (108,4) -- (192,28) ;
\draw    (192,52.72) -- (192,28) ;

\draw (226,40) node [anchor=west] [inner sep=0.75pt]  [font=\scriptsize]  {$h$};
\draw (212,55.4) node [anchor=north] [inner sep=0.75pt]  [font=\scriptsize]  {$w$};
\end{tikzpicture}
\label{fig:patchvsroi_patch}
    }%
    \qquad
    \subfloat[Region-based discriminator]{
\tikzset{every picture/.style={line width=0.25pt}}
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]

\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (182,42) -- (190,42) -- (190,50) -- (182,50) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (182,58) -- (190,58) -- (190,66) -- (182,66) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (182,50) -- (190,50) -- (190,58) -- (182,58) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (182,34) -- (190,34) -- (190,42) -- (182,42) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]  (182,26) -- (190,26) -- (190,34) -- (182,34) -- cycle ;

\draw    (90,82) -- (142,66) ;
\draw    (90,82) -- (90,10) ;
\draw    (90,10) -- (142,26) ;
\draw    (142,66) -- (142,26) ;
\draw    (174,66) -- (174,45.33) -- (174,26) ;
\draw    (158,66) -- (158,26) ;
\draw    (158,26) -- (142,26) ;
\draw    (174,26) -- (158,26) ;
\draw    (158,66) -- (142,66) ;
\draw    (174,66) -- (158,66) ;
\draw    (82,10) -- (82,82) ;
\draw    (10,82) -- (82,82) ;
\draw    (42,10) -- (42,82) ;
\draw    (10,10) -- (10,82) ;
\draw    (14,10) -- (14,82) ;
\draw    (18,10) -- (18,82) ;
\draw    (26,10) -- (26,82) ;
\draw    (22,10) -- (22,82) ;
\draw    (34,10) -- (34,82) ;
\draw    (38,10) -- (38,82) ;
\draw    (46,10) -- (46,82) ;
\draw    (54,10) -- (54,82) ;
\draw    (58,10) -- (58,82) ;
\draw    (62,10) -- (62,82) ;
\draw    (66,10) -- (66,82) ;
\draw    (70,10) -- (70,82) ;
\draw    (74,10) -- (74,82) ;
\draw    (78,10) -- (78,82) ;
\draw    (10,78) -- (82,78) ;
\draw    (10,74) -- (82,74) ;
\draw    (10,70) -- (82,70) ;
\draw    (10,66) -- (82,66) ;
\draw    (10,62) -- (82,62) ;
\draw    (10,58) -- (82,58) ;
\draw    (10,54) -- (82,54) ;
\draw    (10,50) -- (82,50) ;
\draw    (10,46) -- (82,46) ;
\draw    (10,42) -- (82,42) ;
\draw    (10,38) -- (82,38) ;
\draw    (10,34) -- (82,34) ;
\draw    (10,30) -- (82,30) ;
\draw    (10,26) -- (82,26) ;
\draw    (10,22) -- (82,22) ;
\draw    (10,18) -- (82,18) ;
\draw    (10,14) -- (82,14) ;
\draw    (10,10) -- (82,10) ;
\draw    (30,10) -- (30,82) ;
\draw    (50,10) -- (50,82) ;

\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=0 ][line width=0.75]  (46,42) -- (74,42) -- (74,74) -- (46,74) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=0 ][line width=0.75]  (66,18) -- (74,18) -- (74,34) -- (66,34) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=0 ][line width=0.75]  (18,42) -- (38,42) -- (38,54) -- (18,54) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=0 ][line width=0.75]  (18,62) -- (38,62) -- (38,74) -- (18,74) -- cycle ;
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=0 ][line width=0.75]  (18,18) -- (58,18) -- (58,34) -- (18,34) -- cycle ;

\draw (186,69.4) node [anchor=north] [inner sep=0.75pt]  [font=\scriptsize]  {$k$};
\draw (116,46) node  [font=\scriptsize]  {$f$};
\draw (150,46) node  [font=\scriptsize]  {$\rho $};
\draw (166,46) node  [font=\scriptsize]  {$d$};

\end{tikzpicture}\label{fig:patchvsroi_roi}}
\caption{Conventional PatchGAN discriminates over a regular grid of overlapping receptive fields (a) while a region-based discriminator may discriminate an image on arbitrarily-sized regions (b).}\label{Fig1}
\label{fig:patchvsroi}
\end{figure*}

Image photo-realism is enforced in a CycleGAN by a ``PatchGAN'' discriminator,

\begin{equation}
D_{patch} : X \to \{0, 1\}^{h\times w},
\end{equation}

which consists of a sequence of strided convolutions producing a $h\times w$ grid of outputs, with each grid element discriminating an overlapping patch of the inputs, as in Figure \ref{fig:patchvsroi_patch}. The output grid is compared element-wise with a grid of ground truth labels. As will be quantified in Section \ref{sec:results}, this purely unsupervised, standard CycleGAN setup fails to correctly localise DAB in a stain transfer application. This motivates a new type of discriminator, based on region of interest discrimination via a region of interest alignment (RoIAlign) layer. The RoIAlign layer was originally proposed in the Mask R-CNN object detection system~\cite{he2017mask}, and is a generalisation of the classical MaxPool layer, and a way of quantising regions of activation maps of arbitrary size into a standardised dimension. Our proposed RoI discriminator consists of feature extraction layers $f$ followed by a RoIAlign layer $\rho$, and a final discrimination layer $d$, as shown in Figure \ref{fig:patchvsroi_roi}. We formalise it as,

\begin{equation}
D_{roi} : X \times B \to \{0, 1\}^k,
\end{equation}

for image domain $X$ and bounding box domain $B$, where $k$ is the number of bounding boxes. The adversarial loss thus becomes,

\begin{equation}
\mathcal{L}_{ROI}(G, D_{roi}, X, Y) = \frac{1}{2}\mathbb{E}_{\mathbf{x}\in X}[(D_{roi}(\mathbf{x}, \mathcal{B}(\mathbf{x})) - 1)^2] + \frac{1}{2}\mathbb{E}_{\mathbf{y}\in Y}[D_{roi}(G(\mathbf{y}), \mathcal{B}(\mathbf{y}))^2]
\label{eq:roi_adversarial}
\end{equation}

that is, a least squares adversarial loss, where the operator $\mathcal{B}$ returns the set of bounding boxes of an image, provided by a previously generated object library. A pair of RoI discriminators (one for each domain) can then be trained alongside--or instead of--the PatchGAN discriminators (see Appendix A).

\subsection{Library generation for region-based discrimination}
\label{subsec:library}

To train our proposed region-based discriminator, we build a bounding box library by localising cancer and normal cells using an automatic image processing pipeline (see Appendix B). All input tiles (see Section \ref{sec:datasets}) are first decomposed into their hematoxylin-eosin-DAB components. The expert annotations available for H\&E slides identify cancerous regions that may nevertheless contain many interspersed healthy cells. Blob detection applied directly on the HES images is thus prone to false positives, precisely when precision is more important to our downstream algorithm than recall. To mitigate this effect, we apply a Laplacian of Gaussian (LoG) filter ($\sigma = \{1, 2\}$). We then construct a graph of healthy cells where connectivity is determined by a manual threshold ($25$ pixels) on Euclidean distance between detected cells. Graph connected components constitute healthy cell clusters, and the convex hull of each cluster is zeroed-out of the expert annotation. In a final step, a second pass of blob detection ($\sigma=\{10, \dots, 12\}$) is applied to detect the larger, dimmer cancer cells in the unmasked regions. In the case of IHC tiles, we instead perform an Otsu threshold on the DAB channel to isolate the cancerous sub-regions. Cancer cell nuclei feature as elliptical discontinuities in the binarised DAB stain, and can again be detected using a LoG filter ($\sigma = \{7, \dots, 10\}$). Smaller blobs ($\sigma = \{1, \dots, 3\}$) outside the segmented region are taken to be normal cells. The library, consisting of over $100$k cell bounding boxes, is then used for the training of the RoI discriminator.

\subsection{Implementation and training details}

In each experiment, the two CycleGAN generators follow the architecture of a baseline approach~\cite{xu2019gan}, itself based on a network proposed for style transfer~\cite{johnson2016perceptual}. The tile inputs are of size $256\times256$ with three (RGB) channels. The generators consist first of strided convolutions to lower the resolution. A sequence of residual blocks~\cite{he2016deep} of tunable length is then applied. We benchmark $6$ and $9$ residual blocks. Following this, fractionally-strided convolutions restore the input resolution. The PatchGAN discriminators consist of a standard sequence of five strided convolutions and an output layer. This reduces the input to a $8\times8$ patch-wise prediction. This architecture, hereafter referred to as CycleGAN $8\times8$, in reference to the discriminator output size, is trained according to Equation~\ref{eq:cycle_gan}. The baselines and proposed model are all modifications of this core baseline.

Given that our proposed discriminators have a selective receptive field, we control for the receptive field size of the PatchGAN discriminators by modifying the stride of their convolutions. We modify the stride of the first layer from $2$ to $1$ in baseline CycleGAN $16\times16$, doubling the patch output size, and the first two layers in baseline CycleGAN $32\times32$, doubling again. We also implement the conditional CycleGAN model~\cite{xu2019gan}. This introduces two additional networks of its own, which are used to classify tiles in each domain. Here, Equation \ref{eq:cycle_gan} is supplemented with classification and cycle classification losses for the new networks, as well as novel photo-realism and structural similarity losses. Exceptionally, due to the speed and memory constraints of the photo-realism loss, we train this baseline with batch size $2$. In addition, we test a plain conditional CycleGAN without these additional losses.

For our proposed model, the RoI discriminator resembles the PatchGAN, with four stride-$2$ feature convolutions $f$, followed by a RoIAlign layer $\rho$, and a final discrimination layer $d$. Without loss of generality, we restrict cell bounding box dimension to $48\times48$, centered on the library nuclei. Although the cell populations in each tile are often imbalanced, we sample balanced numbers of positives and negatives with replacement, whenever available, equaling  $k = 8$ bounding boxes per tile, and we skip tiles containing no library cells. All model weights are randomly initialised and all models use the Adam optimiser~\cite{kingma2014adam} with maximum learning rate $2$-e4 and $(\beta_0, \beta_1) = (0.5, 0.999)$. Models were trained for $20$ epochs with a batch size of $8$ randomly sampled tiles, consuming roughly two hours of processing time per model on an NVIDIA Tesla V100 GPU.

\section{Datasets}
\label{sec:datasets}

To benchmark our method, we conducted experiments on two breast cancer datasets. One dataset was provided by the Gustave Roussy (GR) Institute consisting of $205$ WSIs, corresponding to sentinel lymph node sections for patients of breast cancer. Each lymph node was imaged with both HES and cytokeratin AE1/AE3 IHC. Although the two stainings are performed on closely situated sections of tissue, the lack of precise alignment implies an unpaired image dataset. Metastatic regions of the HES slides were annotated with bounding contours by two expert pathologists. The dataset comprises cases of micro- and macro-metastases (resp. $0.2$mm-$2$mm and $\geq 2$mm tumours), as well as negative cases. Non-overlapping tiles of size $256\times256$ pixels were extracted at a magnification of $20$x from the segmented tissue regions of WSIs using CLAM~\cite{lu2021data}. For HES slides, the expert annotation is used to extract balanced samples of positive (metastatic tissue) and negative (normal tissue) tiles whereas, for IHC, the thresholded DAB stain substitutes as an experimentally-generated annotation.

CAMELYON16~\cite{litjens20181399} consists of $1399$ hematoxylin-eosin-stained (H\&E) slides. Among these, $111$ slides were annotated in a fashion similar to the GR dataset. We processed and sampled tiles from these slides in the same way, yielding a dataset of $12000$ tiles. Note that this dataset features a slightly different imaging modality, and furthermore contains no IHC slides. Nevertheless, we found that IHC tiles from the GR dataset were fully compatible with CAMELYON16 during model training (provided the imaging magnification), demonstrating that one can combine datasets of different origin for stain transfer.

\section{Experimental results}
\label{sec:results}

\subsection{Tile-level quantitative results}
\label{subsec:tilelevel}

Our primary means of evaluating model performance is with the expert H\&E annotations. This provides a good first approximation to the locations of the cancer cells, and where the DAB should appear once the stain transfer has been performed, even though annotation contours often bisect healthy tissue regions or otherwise contain normal cells. For each of our trained generators, we first produce the IHC stain for each of a set of $500$ held-out test H\&E tiles. We visualise samples of these in Figure \ref{fig:datasets} for both the proposed model and the baseline CycleGAN $8\times8$, alongside the annotation. One may observe the accuracy of our proposed model in localising the DAB stain. Although we observe a weak correlation between positive tiles and the presence of DAB, the baseline CycleGAN systematically misplaces the DAB stain. This localisation problem was observed across all competing models. We hypothesise our proposed model profits from the object-level supervision, with our proposed RoI discriminator performing discrimination directly centered on cells.

\begin{figure*}[t!]%
\centering
\subfloat[Input images]{\includegraphics[width=0.45\textwidth]{img/inputs_mosaic.png}} \qquad
\subfloat[Annotation]{\includegraphics[width=0.45\textwidth]{img/mask_mosaic.png}} \qquad
\subfloat[CycleGAN]{\includegraphics[width=0.45\textwidth]{img/baseline_mosaic.png}} \qquad
\subfloat[Region-guided CycleGAN]{\includegraphics[width=0.45\textwidth]{img/proposed_mosaic.png}}
\caption{Sample H\&E tiles from the GR dataset (a); with corresponding ground truth annotation masks (b); baseline CycleGAN stain transfer (c); and proposed region-guided stain transfer (d).}
\label{fig:datasets}
\end{figure*}

In pursuing a quantitative evaluation, we obtain a binary mask for each synthesised DAB stain in the same manner as was performed in Section \ref{subsec:library} for real IHC tiles. This mask is then compared with the ground truth annotation by DICE similarity and balanced accuracy (BAC), and we report the mean and standard deviation for each metric across all test tiles in Table \ref{table:results}. We emphasise the ground truth is approximate, as it is intended to capture metastatic regions at a macro level, and often does not exclude healthy sub-regions. For each model, we select the best performing instance in a grid search over the number of generator residual blocks $(6, 9)$, and $\lambda_{cyc} = \{1, 10, 30\}$. Models generally performed better with $6$ residual blocks, and with the standard $\lambda_{CYC} = 10$. Our proposed model performs significantly better for $\lambda_{CYC} = 30$, however, seemingly to compensate for the weight of the additional discriminators. We nevertheless note the superiority of our proposed model over all baselines, with $0.536$ DICE and $0.634$ BAC on the GR dataset, and $0.533$ DICE and $0.615$ BAC on CAMELYON16. Among the baselines, we observe that changing the discriminator outputs ($16\times16$ and $8\times8$) can have a positive effect on BAC, but ultimately falls short on DICE. On the other hand, the conditional CycleGANs do not show improvement over the plain baselines. Finally, we observe that our high performance is sustained on CAMELYON16, even though in the absence of a IHC data, GR IHC tiles, of different clinical origin, were used as surrogate.

\begin{table}[t!]
\begin{center}
\begin{tabular}{ |c|c|c|c|c| }
\hline
& \multicolumn{2}{c|}{GR Dataset} & \multicolumn{2}{c|}{CAMEYLON16} \\
  \hline
  Model & DICE & BAC & DICE & BAC \\
  \hline
  CycleGAN ($8 \times 8$) & $0.442\pm0.370$ & $0.490\pm0.103$ & $0.415\pm0.372$ & $0.501\pm0.091$ \\
  \hline
  CycleGAN ($16 \times 16$) & $0.365\pm0.330$ & $0.520\pm0.125$ & $0.388\pm0.349$ & $0.502\pm0.091$ \\
  \hline
  CycleGAN ($32 \times 32$) & $0.384\pm0.324$ & $0.511\pm0.130$ & $0.403\pm0.358$ & $0.503\pm0.100$ \\
  \hline
  Conditional CycleGAN & $0.341\pm0.328$ & $0.488\pm0.120$ & $0.412\pm0.366$ & $0.501\pm0.100$ \\
  \hline
  Xu et al. (2019)~\cite{xu2019gan} & $0.325\pm0.310$ & $0.474\pm0.107$ & $0.260\pm0.257$ & $0.498\pm0.115$ \\
  \hline
  Proposed & $\mathbf{0.536\pm0.360}$ & $\mathbf{0.634\pm0.221}$ & $\mathbf{0.533\pm0.371}$ & $\mathbf{0.615\pm0.197}$ \\
  \hline
\end{tabular}
\caption{DICE similarity and balanced accuracy (BAC) for all baselines and proposed model for GR dataset and CAMELYON16. Each entry reads mean $\pm$ std. Best results in bold.  \label{table:results}}
\end{center}
\end{table}

\subsection{Slide-level qualitative results}

We further explore the capabilities of our method by generating whole slide outputs, as shown for a macrometastatic case (Appendix C, Figure 3a, b, and c) and negative case (Appendix C, Figure 3d, e, and f) from the GR dataset. One may observe that the HES and IHC ground truth slides are unregistered. Here, the model is applied tile-by-tile and the outputs are recombined to produce slide thumbnails. Inference times were $22$s for Appendix C Figure 3b and $14$s for Appendix C Figure 3e. We observe the overall consistency of our model outputs with the IHC ground truth. However, false positives, indicated by misplaced DAB signal, remain a problem for our model, and attenuating these will be the subject of future work. Surprisingly, though these test slides belong to the GR dataset, we found the model trained on CAMELYON16 data produced outputs (pictured) at least comparable to those from the GR model, indicating a readily transferable method.

\section{Discussion}

In this paper we have demonstrated a systematic localisation problem with unsupervised CycleGANs for stain transfer in histopathology tiles, and proposed an improved method using a region-based discriminator, leveraging a library of cell interest regions. We have further shown how datasets of different clinical origin may be successfully combined for learning stain transfer models. The proposed pipeline is a semi-automatic means for extracting additional supervision ``for free'', greatly improving the unsupervised baseline. Although for H\&E data, we still rely on an expert annotation, our experiments revealed exciting possibilities for further automation. Firstly, due to a parsimonious design (only assumptions about cell size and clustering are made), the library building pipeline was equally applicable to both datasets and would likely generalise to others. Secondly, we found datasets could be combined and that a model trained on CAMELYON16 H\&E transfers well to the GR dataset. In the latter case, only annotations from CAMELYON16 have been used, implying reusability of a library once computed on CAMELYON16, a free resource.

\subsubsection{Acknowledgments}
This work was partially supported by the ANR  Hagnodice ANR-21-CE45-0007 and ARC SIGNIT201801286. Experiments have been conducted using HPC resources from the \href{http://mesocentre.centralesupelec.fr/}{"Mésocentre"} computing center of CentraleSupélec and École Normale Supérieure Paris-Saclay supported by CNRS and Région Île-de-France.

redpajama_set_name: RedPajamaArXiv


text:
Home » Canada Scholarship
Category: Canada Scholarship
International Entrance Scholarships at Memorial University of Newfoundland, Canada
The Memorial University of Newfoundland is actively welcoming applications from talented students for its outstanding International Entrance Scholarships. These opportunities are currently available for the academic year of 2021-2022. The programme aims to support worldwide students who are going to enrol in the undergraduate degree programme at the university. Opened in 1925, Memorial University of …
Seneca Renewable Entrance International merit awards at Seneca College, Canada
Do you have a desire to accomplish your degree programme in Canada? Apply for the Seneca Renewable Entrance International merit awards at Seneca College. The programme aims to support international students who want to study a Diploma or Graduate Certificate programme at the college. Seneca College of Applied Arts and Technology is a multiple-campus public …
University of Alberta International Entrance Citation Awards in Canada
University of Alberta International Entrance Citation is a very exciting and fruitful scheme for Alberta's first-time freshmen students. If you are chosen for this programme, you will get a $40,000 reduction on any units completed online. Applications are limited to international students. Established in 1908, the University of Alberta offers a range of academic and …
December Week 4
McMaster University International Award of Excellence in Canada
McMaster University is in the search of enterprising and inspirational students for its wonderful McMaster University Award of Excellence programme. All the deserving candidates will be provided with an award of $3,000 to pursue an undergraduate degree program at McMaster University. Students from any part of the world will benefit from this opportunity. Founded in …
Trudeau Foundation Doctoral Scholarships for International Students at University of British Columbia, Canada
The University of British Columbia is seeking high-potential applicants to take part in the Trudeau Foundation Doctoral Scholarships for the academic year 2021-2022. The programme aims to support international students who want to undertake the doctoral degree programme at the university. The University of British Columbia is consistently ranked among the top 20 public universities …
Faculty of Land and Food System
Human Rights and Social Justice.
humans and their natural environment
Entrance Scholarships for International Students at Vancouver Island University, Canada
With the purpose of rewarding talented students in Canada, Vancouver Island University is granting the Entrance Scholarships for the academic session 2021-2022. The programme is accessible for Canadian and overseas students who want to take part in the undergraduate degree programme at the university. Vancouver Island University is a public university in Canada which …
President's International Scholarship at University of Ottawa, Canada
The University of Ottawa is pleased to announce the President's funding for all international students. The programme is open for the academic session 2021/2022. All the interested students can apply for this wonderful opportunity. This programme aims to help students financially and support them to enhance their knowledge in the field of education and achieve success …
University of Ottawa International Admission Doctorate Scholarships in Canada
Excellent aspirants are invited to become a part of an exciting International Admission Doctorate Scholarships at the University of Ottawa in Canada. The programme is open to students from all around the world. The funding opportunity encourages students who want to commence a PhD degree programme. So, all the interested candidates are welcome at the university to be …
International Entrance Scholarships at Trent University, Canada
Trent University is giving you a chance to expand your career in the right direction through its International Entrance Scholarships. The programme is open for international students who want to take part in the undergraduate degree programme at the university. Trent University was established in 1964 as one of Canada's top universities and supports life …
SFU Graduate Dean's Entrance international awards in Canada, 2021
Simon Fraser University is now awarding Graduate Dean's Entrance international awards in Canada to help and support talented students who want to qualify in their requiring field of education. Graduate Dean's Entrance international awards' main motive is to provide financial support to the deserving and the needy candidates. The grant is open for the academic session on …
Rebanks Family Fellowship and International Performance Residency in Canada
The Royal Conservatory's Glenn Gould School is sponsoring an excellent opportunity through its Rebanks Family Fellowship and International Performance Residency Program. All the interested international candidates may apply for the academic session 2021/2022. The programme focuses on assisting and empowering artists at the centre of a career, providing a rich career development curriculum including private …
Royal Conservatory's Glenn Gould School
Concordia Presidential Scholarships for International students, 2021
Concordia University is pleased to announce the Presidential Scholarships programme for inspired and talented international applicants in Canada. The grant is open for the 2021/2022 academic year. The bursary programme supports undergraduate students who wish to start their education in their respective fields. The grant is provided by the University to help deserving and outstanding …
International Presidential Scholarships at Huron Western University, Canada
With the motive of rewarding students talent in Canada, the Huron Western University is offering the International Presidential Scholarships for the academic year 2021-2022. The programme aims to support international students who are going to enrol in the undergraduate degree programme at the university. Established in 1863 by two Anglican clergyman, Huron University College is …
Huron At Western University
International Student Awards at Southern Alberta Institute of Technology, Canada
Awards help to minimize the cost of education. Therefore, the Southern Alberta Institute of Technology is offering the Student Awards for the academic year 2021-2022. The programme is open for students who want to undertake the undergraduate degree programme at the university. The Southern Alberta Institute of Technology (SAIT) is a polytechnic institute in Calgary, …
Southern Alberta Institute of Technology
IB Scholarships for International Students at Brandon University, Canada
Brandon University is proud to offer IB Scholarships for brilliant candidates who are dreaming of becoming a Canadian graduate. The programme aims to support international students who are going to enrol in the undergraduate degree programme at the university. Established in 1889, Brandon University is a university located in the city of Manitoba, Canada. It …
Brandon University


text:
Q: How to reduce size of .tiff file I am unaware of how to reduce the size of .tif/.tiff extension file. Though I can reduce the size by changing to jpg file but I need it in .tif /.tiff. Kindly help.

A: Opening it in Photoshop and exporting as a .tiff should yield a compression option. I'm not sure if supported, but you could also try GIMP.
"Generally when you save a TIFF in Photoshop, you'll see a dialog that is titled "TIFF Options". The first option is for Image Compression. You can choose the type of compression you want to use: None, LZW, ZIP, or JPEG."
- http://www.reuniontalk.com/showthread.php?t=8733


text:
The Dollar Is Losing It's Luster And Obama Is Still Busy Making Deals
Is everybody ready to go here and sign up to run for political office? You might be after you read this post.
Pimco Says Dollar to Weaken as Reserve Status Erodes (Update3)
Aug. 19 (Bloomberg) — Pacific Investment Management Co., which runs the world's biggest bond fund, said the dollar will weaken as the U.S. pumps "massive" amounts of money into the economy.
The dollar will drop the most against emerging-market counterparts, Curtis A. Mewbourne, a Pimco portfolio manager, wrote in a report on the company's Web site. The greenback is losing its status as the world's reserve currency, he said.
"Investors should consider whether it makes sense to take advantage of any periods of U.S. dollar strength to diversify their currency exposure," Mewbourne wrote in his August Emerging Markets Watch report. "The massive amounts of U.S. dollar liquidity produced in response to the crisis" have helped reduce demand for the currency, he wrote.
The Dollar Index, which tracks the greenback against a basket of currencies, touched 78.823 today, the lowest this week. It has fallen 12 percent from this year's high in March as U.S. authorities pledged $12.8 trillion to combat the recession. China, the world's largest holder of foreign-currency reserves, and Russia have both called for a new global currency to replace the dollar as the dominant place to store reserves.
"While we have not yet reached the point where a new global reserve currency will arise, we are clearly seeing a loss of status for the U.S. dollar as a store of value even in the absence of a single viable alternative," Mewbourne wrote.
The U.S. government boosted spending and the Federal Reserve bought bonds to revive credit markets that seized up after financial companies posted $1.6 trillion in writedowns and losses, raising concern there is an oversupply of greenbacks.
Meanwhile, it appears the hater in the house (WH) is helping out his old buddy George Soros with Petrobras; a Brazilian Oil Company:
Obama Underwrites Offshore Drilling
You read that headline correctly. Unfortunately, the Obama Administration is financing oil exploration off Brazil.
The U.S. is going to lend billions of dollars to Brazil's state-owned oil company, Petrobras, to finance exploration of the huge offshore discovery in Brazil's Tupi oil field in the Santos Basin near Rio de Janeiro. Brazil's planning minister confirmed that White House National Security Adviser James Jones met this month with Brazilian officials to talk about the loan.
The U.S. Export-Import Bank tells us it has issued a "preliminary commitment" letter to Petrobras in the amount of $2 billion and has discussed with Brazil the possibility of increasing that amount. Ex-Im Bank says it has not decided whether the money will come in the form of a direct loan or loan guarantees. Either way, this corporate foreign aid may strike some readers as odd, given that the U.S. Treasury seems desperate for cash and Petrobras is one of the largest corporations in the Americas.
But look on the bright side. If President Obama has embraced offshore drilling in Brazil, why not in the old U.S.A.? The land of the sorta free and the home of the heavily indebted has enormous offshore oil deposits, and last year ahead of the November elections, with gasoline at $4 a gallon, Congress let a ban on offshore drilling expire.
Well not here in the USA until more of his backers buy oil companies.
From Bloomberg on August 15, 2008
Soros Hedge Fund Bought Petrobras Stake Worth $811 Million
Aug. 15 (Bloomberg) — Billionaire investor George Soros bought an $811 million stake in Petroleo Brasileiro SA in the second quarter, making the Brazilian state-controlled oil company his investment fund's largest holding.
As of June 30, the stake in Petrobras, as the Rio de Janeiro-based oil producer is known, made up 22 percent of the $3.68 billion of stocks and American depositary receipts held by Soros Fund Management LLC, according to a filing with the U.S. Securities and Exchange Commission. Petrobras has since slumped 28 percent.
George Soros Cut Petrobras Stake in Second Quarter (Update2)
Aug. 14 (Bloomberg) — Billionaire George Soros cut his stake in his biggest holding, Petroleo Brasileiro SA, in the second quarter while buying more shares of other energy producers.
His New York-based hedge-fund firm, Soros Fund Management LLC, sold 22 million U.S.-listed common shares of Petrobras, as the Brazilian oil company is known, according to a filing today with the U.S. Securities and Exchange Commission. Soros bought 5.8 million of the company's U.S.-traded preferred shares.
Here is where he has bought now, and where you want to keep your eye.
Soros boosted his stake in oil company Hess Corp. to 5.1 million shares as of June 30 from 3.7 million at the end of the first quarter, according to the filing. Hess was Soros's second- largest holding. He also added to stakes in Houston-based Plains Exploration & Production Co. and bought shares in Calgary-based Suncor Energy Inc. and InterOil Corp. in Sydney.
It appears Bambi is using our money because George pulled his, AND he still wants to be able to eat his cake too.
Ready to go to that link in the first sentence?


Soren Wheeler is the Managing Editor at Radiolab, where he plays a variety of roles, including producer, editor, and reporter. He also oversees the development of future content. Before coming to radio, Soren spent 10 years working with science teachers and writing about how kids learn science. He was a project coordinator at the Association for the Advancement of Science, where he co-authored the book Atlas of Science Literacy. He then went on to get a Master's degree in science writing at Johns Hopkins University. Soren has won awards for production on radio pieces about coincidence and statistics, the periodic table, and the story of a woman waking up from a coma.


Systems, including GPS, Galileo, GLONASS, and QZSS, the AT11 Fixed Attenuators provide a user specified attenuation from 2 to 40dB. The AT11 also includes the option to pass the receive antenna LNA DC bias voltage through the device or to block the DC path to the antenna. The most common application is taking the input level to a GPS receiver or a GPS test set is reduced via the fixed attenuation of the AT11. The AT11 is available with more options than any competitive product on the market.