Mercurial > hg > orthanc-java
comparison Samples/MammographyDeepLearning/src/main/java/Rectangle.java @ 28:43923934e934
added sample: deep learning for mammography
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 Jun 2024 13:58:29 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
27:4a750ca9461e | 28:43923934e934 |
---|---|
1 /** | |
2 * SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium | |
3 * SPDX-License-Identifier: GPL-3.0-or-later | |
4 **/ | |
5 | |
6 /** | |
7 * Java plugin for Orthanc | |
8 * Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium | |
9 * | |
10 * This program is free software: you can redistribute it and/or | |
11 * modify it under the terms of the GNU General Public License as | |
12 * published by the Free Software Foundation, either version 3 of the | |
13 * License, or (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, but | |
16 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 * General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 **/ | |
23 | |
24 | |
25 import java.io.Serializable; | |
26 | |
27 class Rectangle implements Serializable { | |
28 private float x1; | |
29 private float y1; | |
30 private float x2; | |
31 private float y2; | |
32 | |
33 public Rectangle(float x1, | |
34 float y1, | |
35 float x2, | |
36 float y2) { | |
37 if (x1 > x2) { | |
38 throw new IllegalArgumentException(); | |
39 } | |
40 if (y1 > y2) { | |
41 throw new IllegalArgumentException(); | |
42 } | |
43 this.x1 = x1; | |
44 this.y1 = y1; | |
45 this.x2 = x2; | |
46 this.y2 = y2; | |
47 } | |
48 | |
49 public float getX1() { | |
50 return x1; | |
51 } | |
52 | |
53 public float getY1() { | |
54 return y1; | |
55 } | |
56 | |
57 public float getX2() { | |
58 return x2; | |
59 } | |
60 | |
61 public float getY2() { | |
62 return y2; | |
63 } | |
64 | |
65 public float getWidth() { | |
66 return x2 - x1; | |
67 } | |
68 | |
69 public float getHeight() { | |
70 return y2 - y1; | |
71 } | |
72 | |
73 public float getArea() { | |
74 return getWidth() * getHeight(); | |
75 } | |
76 } |