Pathology Visions 2007 Customizing Spectrum for the Research

  • Slides: 30
Download presentation
Pathology Visions 2007 Customizing Spectrum for the Research Environment Jim Deeds 23 OCT 2007

Pathology Visions 2007 Customizing Spectrum for the Research Environment Jim Deeds 23 OCT 2007

Outline §The research environment - differences from the clinical lab §PHP / SQL basics

Outline §The research environment - differences from the clinical lab §PHP / SQL basics §Examples • Welcome screen, added menu items, news, custom displays for users • Projects (the heart of research work), users work spaces • Custom reports / canned queries • Using Spectrum as a LIMS §Analysis §Summary findings 2 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

The research environment §There is great variety in the lab processes employed rather than

The research environment §There is great variety in the lab processes employed rather than a small number of well documented SOPs and clear work flow. §Specimens are often used in multiple ‘projects’ §Slides need to be associated with projects (but also maintain a link to specimen data) §Users need flexibility / variation in queries and report format §Not all fields can use controlled vocabulary and often times users cannot remember which field contains the keyword they are looking for – how do you find anything? 3 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Getting data in – the slide scanner as Trojan horse §Why is it difficult

Getting data in – the slide scanner as Trojan horse §Why is it difficult to get data entry done in a timely and accurate way? • With conventional glass slides, it is easy to collect groups of slides in slide flats and attach paper forms with hand-written sample and staining details. • There is no compelling reason to enter data into an electronic form until much later - if at all. §However, when slides are scanned, users must annotate them in order to find the images • This is a perfect opportunity to help the user enter the meta data easily • Provide a variety of search and custom report tools so that users have options to find their data ? 4 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

The elements of CRUD Custom interactions with the database can be built easily with

The elements of CRUD Custom interactions with the database can be built easily with PHP and SQL The standard interactions with a database are sometimes referred to as ‘CRUD’ • Create: SQL INSERT • Read: SQL SELECT • Update: SQL UPDATE • Delete: SQL DELETE References: http: //www. w 3 schools. com/php/default. asp http: //www. php. net/ PHP and My. SQL for dynamic web sites, Ullman L, (2005) PHP Hacks: Tips & Tools for Creating Dynamic Web Sites, Herrington JD, (2005) 5 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

The elements of CRUD: Query PHP Outline //Connecting to the database $conn = odbc_connect("DRIVER={SQL

The elements of CRUD: Query PHP Outline //Connecting to the database $conn = odbc_connect("DRIVER={SQL Server}; SERVER=my. Server; DATABASE=aperio", “db. User", “dbpassword" ); //Declaring the SQL query $sql = "select … ; "; //Executing the query $rs = odbc_exec($conn, $sql); // Simple but unformatted display of the data $nr = odbc_result_all($res, "BGCOLOR='#f 0 f 0 f 0' border=2 cellspacing=1"); //OR read results into variables and display with more format echo "<table class='List. Table'cellspacing=0><tr>"; while (odbc_fetch_row($rs)) { echo "<tr class='row'>"; $field 1=odbc_result($rs, "Specimen. ID"); $field 2=odbc_result($rs, "Block"); $field 3=odbc_result($rs, "Prog") echo "<td><a href='Edit. Record. php? Table. Name=Specimen&Ids[]=$field 1'>$field 1</td>"; echo "<td>$field 2</td>"; echo "<td>$field 3</td>"; echo "</tr>"; } echo "</table>"; Direct database queries can be made using the PHP ‘odbc’ commands Records can be displayed using the stylesheet formatting for a consistent look and feel 6 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

The elements of CRUD: example query $sql = “SELECT Specimen. ID = sp. Id

The elements of CRUD: example query $sql = “SELECT Specimen. ID = sp. Id , Block = sp. Accession. Number , Prog = sp. Column 02 , Tissue = sp. Body. Site , Dx = sp. Specimen. Received , Treatment = sp. Column 01 This example returns image analysis results for a specified project – ‘$Parent. Id’ , Stain = sl. Stain , Slide. ID = sl. Id , Slide. Parent = sl. Column 10 , Image. ID = im. Image. Id , Annot. ID = ann. Annotation. Id , Annot. Attrib. ID = anat. Annotation. Attribute. Id , Annot. Attrib. Name = anat. Attribute. Name , Annot. Attrib. Value = anat. Attribute. Value FROM Aperio. . Specimen sp, Aperio. . Slide sl, Aperio. . Image im, Aperio. . Annotation ann, Aperio. . Annotation. Attribute anat WHERE sl. Parent. Table = 'Specimen' AND sl. Parent. Id = sp. Id AND im. Parent. Table = 'Slide' AND im. Parent. Id = sl. Id AND sl. Column 10 = '$Parent. Id' AND ann. Image. Id = im. Image. Id AND anat. Annotation. Id = ann. Annotation. Id AND (anat. Attribute. Name = 'Percent Feature[3]' OR anat. Attribute. Name = 'Percent Feature[2]' OR anat. Attribute. Name = 'Percent Feature[1]' OR anat. Attribute. Name ='Percent Feature[0]') ORDER BY sp. Accession. Number , sl. Id , ann. Annotation. Id , anat. Attribute. Name ; "; 7 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Examples of custom reports / canned queries Problem Reporting Solution Users need to find

Examples of custom reports / canned queries Problem Reporting Solution Users need to find information but are not sure of which table or field to search and/or how the search term was spelled. ‘Anything/anywhere’ (Google-like search) DBA needs to identify data entry errors. Specimens and slides with common data entry problems Managers need an up to date estimate of current project costs. Reagent usage and estimated cost for each project (display number of specimens and stained slides produced and estimated FTE and dollar costs) Users want to view only a few fields of image analysis data from all slides used in a particular project. Extracted data from all slides belonging to a project (values + ‘bar graph display’) Users want to know what new projects, specimens, slides and documents have been added since their last visit. New records since last user visit / login 8 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Welcome Screen Added menu items, news, custom displays for users… 9 | Visions 2007

Welcome Screen Added menu items, news, custom displays for users… 9 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Edit Project(1) modifications This generates an ‘anything/anywhere’ search using our ‘external project ID’ as

Edit Project(1) modifications This generates an ‘anything/anywhere’ search using our ‘external project ID’ as the keyword These links display summary image analysis data from all slides used in this project This displays all markup images generated by analysis algorithms, these markups can then be analyzed with other analysis tools – ‘chaining algorithms’. 10 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Other Project Actions Show Related Items 11 | Visions 2007 | Spectrum for Research

Other Project Actions Show Related Items 11 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Other Project Actions Show Data Parent specimen Info Slide Info 12 | Visions 2007

Other Project Actions Show Data Parent specimen Info Slide Info 12 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007 Algorithm Output Data

Edit Project(2) modifications We use project images like figures in a publication. We have

Edit Project(2) modifications We use project images like figures in a publication. We have added a link to let users easily edit the ‘figure legend text’ 13 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Edit Project(3) modifications This is an alternative view of project-associated specimens not using the

Edit Project(3) modifications This is an alternative view of project-associated specimens not using the Aperio Parent. Table/Parent. Id mechanism. This displays slides that have been directly associated with the project (i. e. – their parent specimen does not need to belong to the project) 14 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007 Parent specimen Info Slide Info

Using Spectrum as a LIMS Functions added at Novartis Vend unique specimen IDs with

Using Spectrum as a LIMS Functions added at Novartis Vend unique specimen IDs with custom prefixes. Vend unique slide IDs prior to slide scanning. Upload specimen and slide data using excel sheets (xml format) Antibody Table – links to protocols, spec sheets, gene IDs, slides stained Automatically generate links to other labs specimen database 15 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Using Spectrum as a LIMS Cautions • Create new tables in the Aperio database

Using Spectrum as a LIMS Cautions • Create new tables in the Aperio database for your new data – ideally these should be the only records that you modify. • Be very careful about giving all users access to create, update and delete functions – especially those that affect Aperio generated tables. • Use validation rules on data entry to insure that data entry matches field data type • Security Basics: - Using direct database calls can leave you vulnerable to a SQL-injection attack on your database (hackers with access to your website can delete/modify your data) - Validate the contents of form fields to strip out SQL reserved characters - Create a read-only database user for queries that are read-only (i. e. – select statements) 16 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis • Additional reports for analysis: - All Recent Jobs (links for Macro, Slide

Analysis • Additional reports for analysis: - All Recent Jobs (links for Macro, Slide and Project details) - Macro details • Auto-circling MATLAB tool • General purpose pixel classifier -> regions of analysis (chaining) • Optimizing parameters for IHC NUC 17 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis Show All Recent Jobs Browse to macro, slide and project details 18 |

Analysis Show All Recent Jobs Browse to macro, slide and project details 18 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis - Auto-tissuefinder Auto-circling multiple pieces of tissue Mat. LAB tool opens svs files

Analysis - Auto-tissuefinder Auto-circling multiple pieces of tissue Mat. LAB tool opens svs files through Aperio API, finds tissue and generates selection layers for each piece of tissue. An sis file can be used to submit multiple slides. 19 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis – Pixel Classifier Schematic Why? Need a general purpose tool to measure %s

Analysis – Pixel Classifier Schematic Why? Need a general purpose tool to measure %s of different cell types in a section (e. g. - % tumor) Need to automate selection of regions for analysis (e. g. - nuclear count algorithm run on only the viable tumor cells) SPECTRUM Image. Scope Image db Com. Line Algorithm* * Developed with Image. Scope SDK, collaboration with Allen Olson. 20 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007 Markup image Input image tile Seg file Classifier Program Output image tile

Analysis– Pixel Classifier Example 21 | Visions 2007 | Spectrum for Research | Jim

Analysis– Pixel Classifier Example 21 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007 We can measure these areas Green: viable tumor (55%) Red: fibroblasts (36%) Blue necrosis (9%)

Analysis– Pixel Classifier chaining with other algorithms Color Deconv 9% positive Pixel classify Color

Analysis– Pixel Classifier chaining with other algorithms Color Deconv 9% positive Pixel classify Color Deconv 15% positive 22 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis optimizing parameters for the IHC Nuclear algorithm Generally, we typically use these as

Analysis optimizing parameters for the IHC Nuclear algorithm Generally, we typically use these as our starting settings (parameters highlighted in yellow are most critical): The two parameters which appear to influence correct segmentation of nuclei are ‘averaging radius’ and ‘curvature threshold’ (see next slide). 23 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis effect of varying two parameters (IHC-NUC) Increasing ‘Curvature Threshold’ Increasing ‘Averaging Radius’ These

Analysis effect of varying two parameters (IHC-NUC) Increasing ‘Curvature Threshold’ Increasing ‘Averaging Radius’ These parameters appear to most accurately segment nuclei 24 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis effect of varying two parameters (IHC-NUC) Increasing ‘Curvature Threshold’ Increasing ‘Averaging Radius’ %

Analysis effect of varying two parameters (IHC-NUC) Increasing ‘Curvature Threshold’ Increasing ‘Averaging Radius’ % pos nuc Ave nuc size Over these ranges of parameters, percent positive nuclei values vary from 45 – 75% 25 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis effect of varying two parameters (IHC-NUC) The expected average nuclear size is ~150

Analysis effect of varying two parameters (IHC-NUC) The expected average nuclear size is ~150 pixels. Any parameters which produce nuclei around this size appear to yield a % positive nuclei value around 62%. Could average nuclear size be used to QC adequacy of analysis parameters? Are there a fairly wide range of parameters that would still yield quality results? 26 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Summary PHP is easy to learn and very powerful. A bench biologist can learn

Summary PHP is easy to learn and very powerful. A bench biologist can learn enough to start adding useful features quickly. Whenever possible, provide links forward and back between objects (main three tables but also for documents, data results, analysis batches, macro details…) Build in protocycle mode rather than top down uber-design A primary challenge of any laboratory system is to get data entered in a timely and consistent manner • Help the user by streamlining data entry • Provide a payoff - easy access to their data via reports and auto-filtering • Transparency about who is entering data promotes healthy competition and helps users share ideas. • Start getting data in as soon as possible so that you understand the real data entry issues to deal with (you will focus on major issues rather than nice-to-have features). Data can be cleaned later. 27 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Contributions Hanif Khalak, Quan Yang – IT Jon Baron – Path. TRAC Judy Shim

Contributions Hanif Khalak, Quan Yang – IT Jon Baron – Path. TRAC Judy Shim – Database Administrator Yan Gao, Helen He, Ron Meyer, Lance Ostrom, Min He, Jane Gu – System Users / Testers Beccy Mosher – Pathologist Bob Schlegel, Bill Sellers – Support and Vision 28 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Additional Slides 29 | Visions 2007 | Spectrum for Research | Jim Deeds |

Additional Slides 29 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007

Analysis Submit multiple analyses Example: run a set of nine macros on the same

Analysis Submit multiple analyses Example: run a set of nine macros on the same image(s) to evaluate the effect of varying ‘curvature threshold’ and ‘averaging radius’ parameters between 0 and 3: IHCOPT_AR 0_CT 0 IHCOPT_AR 0_CT 15 IHCOPT_AR 0_CT 30 IHCOPT_AR 15_CT 15 IHCOPT_AR 15_CT 30 IHCOPT_AR 30_CT 15 To use: • Select slides to be analyzed in Spectrum • Click ‘Analyze’ link • Select input annotation layer to be analyzed and select analysis macro: ‘IHCOPT_MULTI_1’ • Click ‘Analyze’ button. • All nine algorithms will be run on your slide(s). 30 | Visions 2007 | Spectrum for Research | Jim Deeds | 22 OCT 2007