public IHttpActionResult PostPathology(Pathologies pathology) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Pathologies.Add(pathology); try { db.SaveChanges(); } catch (DbUpdateException) { if (PathologyExists(pathology.Name)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = pathology.Name }, pathology)); }
public IHttpActionResult PutPathology(string id, Pathologies pathology) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pathology.Name) { return(BadRequest()); } db.Entry(pathology).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PathologyExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public override int GetHashCode() { unchecked { return(((Pathologies != null ? Pathologies.GetHashCode() : 0) * 397) ^ (Diagnoses != null ? Diagnoses.GetHashCode() : 0)); } }
public static List <DdsmImage> GetAllImagesFromCsvFile(String csvFilePath) { List <DdsmImage> imagesToReturn = new List <DdsmImage>(); TextReader reader = new StreamReader(csvFilePath); var csvReader = new CsvReader(reader); csvReader.Read(); //skip header while (csvReader.Read()) { ImageViewEnum imageView = ImageViewEnum.Cc; if (csvReader.GetField(3).Equals("MLO")) { imageView = ImageViewEnum.Mlo; } Pathologies pathology = Pathologies.Benign; if (csvReader.GetField(9).Equals("MALIGNANT")) { pathology = Pathologies.Malignant; } if (csvReader.GetField(9).Equals("BENIGN_WITHOUT_CALLBACK")) { pathology = Pathologies.BenignWithoutCallback; } String dcomFilePath = GetDcomFilePathFromString(csvFilePath, csvReader.GetField(11)); var(maskFilePath, croppedFilePath) = GetDcomMaskAndCroppedPathsFromString(csvFilePath, csvReader.GetField(12)); imagesToReturn.Add(new DdsmImage(imageView, pathology, dcomFilePath, maskFilePath, croppedFilePath)); } return(imagesToReturn); }
private DdsmImage(ImageViewEnum imageView, Pathologies pathology, string dcomFilePath, string dcomMaskFilePath, string dcomCroppedFilePath) { ImageView = imageView; Pathology = pathology; DcomFilePath = dcomFilePath; DcomMaskFilePath = dcomMaskFilePath; DcomCroppedFilePath = dcomCroppedFilePath; }
public IHttpActionResult DeletePathology(string id) { Pathologies pathology = db.Pathologies.Find(id); if (pathology == null) { return(NotFound()); } db.Pathologies.Remove(pathology); db.SaveChanges(); return(Ok(pathology)); }